Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: net/base/host_resolver_impl.cc

Issue 1604045: Fix crash on IP address change. (Closed)
Patch Set: Merge conflict Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/host_resolver_impl.h ('k') | net/base/host_resolver_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/host_resolver_impl.cc
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index 1f43c606b2b329115e19ead6a447bcc548525e89..df5bc7905b2f8acb3ef67c8fb5d70a416795fdbc 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -683,6 +683,8 @@ HostResolverImpl::HostResolverImpl(
#if defined(OS_WIN)
EnsureWinsockInit();
#endif
+ if (network_change_notifier_)
+ network_change_notifier_->AddObserver(this);
}
HostResolverImpl::~HostResolverImpl() {
@@ -697,6 +699,9 @@ HostResolverImpl::~HostResolverImpl() {
if (cur_completing_job_)
cur_completing_job_->Cancel();
+ if (network_change_notifier_)
+ network_change_notifier_->RemoveObserver(this);
+
// Delete the job pools.
for (size_t i = 0u; i < arraysize(job_pools_); ++i)
delete job_pools_[i];
@@ -841,7 +846,7 @@ void HostResolverImpl::SetDefaultAddressFamily(AddressFamily address_family) {
void HostResolverImpl::ProbeIPv6Support() {
DCHECK(!ipv6_probe_monitoring_);
ipv6_probe_monitoring_ = true;
- Flush(); // Give initial setup call.
+ OnIPAddressChanged(); // Give initial setup call.
}
void HostResolverImpl::Shutdown() {
@@ -1074,7 +1079,7 @@ void HostResolverImpl::OnCancelRequest(const BoundNetLog& net_log,
net_log.EndEvent(NetLog::TYPE_HOST_RESOLVER_IMPL);
}
-void HostResolverImpl::Flush() {
+void HostResolverImpl::OnIPAddressChanged() {
if (cache_.get())
cache_->clear();
if (ipv6_probe_monitoring_) {
« no previous file with comments | « net/base/host_resolver_impl.h ('k') | net/base/host_resolver_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698