diff options
Diffstat (limited to 'chrome/browser/net/dns_global.cc')
-rw-r--r-- | chrome/browser/net/dns_global.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/chrome/browser/net/dns_global.cc b/chrome/browser/net/dns_global.cc index 2f85b59..b34de8a 100644 --- a/chrome/browser/net/dns_global.cc +++ b/chrome/browser/net/dns_global.cc @@ -377,9 +377,13 @@ void DnsPrefetchGetHtmlInfo(std::string* output) { static PrefetchObserver dns_resolution_observer; void InitDnsPrefetch(PrefService* user_prefs) { + // Use a large shutdown time so that UI tests (that instigate lookups, and + // then try to shutdown the browser) don't instigate the CHECK about + // "some slaves have not finished" + const TimeDelta kAllowableShutdownTime(TimeDelta::FromSeconds(10)); DCHECK(NULL == dns_master); if (!dns_master) { - dns_master = new DnsMaster(); + dns_master = new DnsMaster(kAllowableShutdownTime); // We did the initialization, so we should prime the pump, and set up // the DNS resolution system to run. off_the_record_observer.Register(); @@ -398,8 +402,14 @@ void InitDnsPrefetch(PrefService* user_prefs) { void ShutdownDnsPrefetch() { DCHECK(NULL != dns_master); - delete dns_master; + DnsMaster* master = dns_master; dns_master = NULL; + if (master->ShutdownSlaves()) { + delete master; + } else { + // Leak instance if shutdown problem. + DCHECK(0); + } } static void DiscardAllPrefetchState() { |