summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-23 19:22:13 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-23 19:22:13 +0000
commit53c4c6201b2e4c46a1cb0f23531faa19455ecc9d (patch)
treec8db0409f0cd9550958933e4e61dbbf0f4acb40e /chrome/browser/net
parent881d0b88dc7efc86923821222cd525b7f11d986a (diff)
downloadchromium_src-53c4c6201b2e4c46a1cb0f23531faa19455ecc9d.zip
chromium_src-53c4c6201b2e4c46a1cb0f23531faa19455ecc9d.tar.gz
chromium_src-53c4c6201b2e4c46a1cb0f23531faa19455ecc9d.tar.bz2
Fix a crash when dns prefetching was being shut down without being started.
This happened when BrowserMain exited before the point when we initialized dns prefetching, but after BrowserProcessImpl was created. We do shutdown of dns prefetching in ~BrowserProcessImpl. Example way to trigger the crash: open a saved HTML page while Chrome is already running. Change ShutdownDnsPrefetch to EnsureDnsPrefetchingShutdown which does nothing if dns prefetching has not been initialized. This is the simplest way to prevent the crash and we don't want to complicate the startup sequence even more. BUG=7900 Review URL: http://codereview.chromium.org/27048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10201 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/dns_global.cc6
-rw-r--r--chrome/browser/net/dns_global.h5
2 files changed, 6 insertions, 5 deletions
diff --git a/chrome/browser/net/dns_global.cc b/chrome/browser/net/dns_global.cc
index 9733e52..09fe5e0 100644
--- a/chrome/browser/net/dns_global.cc
+++ b/chrome/browser/net/dns_global.cc
@@ -399,9 +399,9 @@ void InitDnsPrefetch(PrefService* user_prefs) {
}
}
-void ShutdownDnsPrefetch() {
- DCHECK(NULL != dns_master);
- dns_master->Shutdown();
+void EnsureDnsPrefetchShutdown() {
+ if (NULL != dns_master)
+ dns_master->Shutdown();
}
void FreeDnsPrefetchResources() {
diff --git a/chrome/browser/net/dns_global.h b/chrome/browser/net/dns_global.h
index 80cf6ff..b7b1d5e 100644
--- a/chrome/browser/net/dns_global.h
+++ b/chrome/browser/net/dns_global.h
@@ -23,8 +23,9 @@ namespace chrome_browser_net {
// functions.
void InitDnsPrefetch(PrefService* user_prefs);
-// Cancel pending lookup requests and don't make new ones.
-void ShutdownDnsPrefetch();
+// Cancel pending lookup requests and don't make new ones. Does nothing
+// if dns prefetching has not been initialized (to simplify its usage).
+void EnsureDnsPrefetchShutdown();
// Free all resources allocated by InitDnsPrefetch. After that you must not call
// any function from this file.