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

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

Issue 15076: Clean up dns prefetch code, and also port it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: use scoper for init & free 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
Index: chrome/browser/net/dns_global.cc
diff --git a/chrome/browser/net/dns_global.cc b/chrome/browser/net/dns_global.cc
index 4e1f1a22ba2d9872eec37dba78dc1a185bd9f475..9733e52508c13fb2eff6c96a40b805dbfe69121c 100644
--- a/chrome/browser/net/dns_global.cc
+++ b/chrome/browser/net/dns_global.cc
@@ -382,7 +382,7 @@ void InitDnsPrefetch(PrefService* user_prefs) {
const TimeDelta kAllowableShutdownTime(TimeDelta::FromSeconds(10));
DCHECK(NULL == dns_master);
if (!dns_master) {
- dns_master = new DnsMaster(kAllowableShutdownTime);
+ dns_master = new DnsMaster();
// We did the initialization, so we should prime the pump, and set up
// the DNS resolution system to run.
off_the_record_observer.Register();
@@ -401,14 +401,13 @@ void InitDnsPrefetch(PrefService* user_prefs) {
void ShutdownDnsPrefetch() {
DCHECK(NULL != dns_master);
- DnsMaster* master = dns_master;
+ dns_master->Shutdown();
+}
+
+void FreeDnsPrefetchResources() {
+ DCHECK(NULL != dns_master);
+ delete dns_master;
dns_master = NULL;
- if (master->ShutdownSlaves()) {
- delete master;
- } else {
- // Leak instance if shutdown problem.
- DCHECK(0);
- }
}
static void DiscardAllPrefetchState() {

Powered by Google App Engine
This is Rietveld 408576698