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

Unified Diff: chrome/browser/net/dns_global.cc

Issue 21133: Revert "Clean up dns prefetch code, and also port it." (Closed)
Patch Set: Created 11 years, 10 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 | « chrome/browser/browser.vcproj ('k') | chrome/browser/net/dns_host_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/dns_global.cc
diff --git a/chrome/browser/net/dns_global.cc b/chrome/browser/net/dns_global.cc
index 2f85b5912053e084a825b816efad2fb4feecd753..b34de8a3b4859398feafa70b4dc99f64e5df95bc 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() {
« no previous file with comments | « chrome/browser/browser.vcproj ('k') | chrome/browser/net/dns_host_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698