Skip to content
Commit 7d7be528 authored by Stefano Duo's avatar Stefano Duo Committed by Chromium LUCI CQ
Browse files

Add HostResolverManager::RemoveResolveContextRegistrationIfNeeded

ResolveContext::MustRegisterForNotifications becomes an invariant only
after ResolveContext::set_url_request_context is called.
HostResolverManager::RemoveResolveContextRegistrationIfNeeded provides a
way to work around that.

With the introduction of URLRequestContext::BindToNetwork,
ResolveContexts may require not to receive for DNS cache
invalidations after a change to network or DNS configurations. This is
abstracted away through MustRegisterForNotifications. Ideally that
function would be an invariant for the entire lifetime of a
ResolveContext, unfortunately it is not due to the current
ResolveContexts creation procedure: at construction time they are not
yet associated to any URLRequestContext, the association is applied as
a second step after creation. For this reason
MustRegisterForNotifications can initially return a different value
(since its implementation depends on ResolveContext:url_request_context)

Since HostResolveManager evaluates MustRegisterForNotifications before
the association is applied, it can read inconsistent values within
HostResolveManager::RegisterResolveContext and
HostResolveManager::DeregisterResolveContext.

Bug: 1292548
Change-Id: I65ee12c0b6faadba01e211db14428d8aa43ff149
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3498103


Reviewed-by: default avatarAdam Rice <ricea@chromium.org>
Commit-Queue: Stefano Duo <stefanoduo@google.com>
Cr-Commit-Position: refs/heads/main@{#979733}
parent af4f4e5e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment