summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_process_impl.cc11
-rw-r--r--chrome/browser/net/sdch_dictionary_fetcher.h4
-rw-r--r--net/base/sdch_manager.cc7
-rw-r--r--net/base/sdch_manager.h3
4 files changed, 23 insertions, 2 deletions
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index a031374..759934b 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/google_url_tracker.h"
#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/browser/net/dns_global.h"
+#include "chrome/browser/net/sdch_dictionary_fetcher.h"
#include "chrome/browser/plugin_service.h"
#include "chrome/browser/profile_manager.h"
#include "chrome/browser/renderer_host/render_process_host.h"
@@ -143,10 +144,16 @@ BrowserProcessImpl::~BrowserProcessImpl() {
// this destructor is run.
automation_provider_list_.reset();
+ // We need to shutdown the SdchDictionaryFetcher as it regularly holds
+ // a pointer to a URLFetcher, and that URLFetcher (upon destruction) will do
+ // a PostDelayedTask onto the IO thread. This shutdown call will both discard
+ // any pending URLFetchers, and avoid creating any more.
+ SdchDictionaryFetcher::Shutdown();
+
// We need to destroy the MetricsService and GoogleURLTracker before the
// io_thread_ gets destroyed, since both destructors can call the URLFetcher
- // destructor, which does an InvokeLater operation on the IO thread. (The IO
- // thread will handle that URLFetcher operation before going away.)
+ // destructor, which does an PostDelayedTask operation on the IO thread. (The
+ // IO thread will handle that URLFetcher operation before going away.)
metrics_service_.reset();
google_url_tracker_.reset();
diff --git a/chrome/browser/net/sdch_dictionary_fetcher.h b/chrome/browser/net/sdch_dictionary_fetcher.h
index a0a9e2f..e9e092c 100644
--- a/chrome/browser/net/sdch_dictionary_fetcher.h
+++ b/chrome/browser/net/sdch_dictionary_fetcher.h
@@ -31,6 +31,10 @@ class SdchDictionaryFetcher : public URLFetcher::Delegate,
// SdchManager class with the dictionary's text.
virtual void Schedule(const GURL& dictionary_url);
+ // Stop fetching dictionaries, and abandon any current URLFetcheer operations
+ // so that the IO thread can be stopped.
+ static void Shutdown() { SdchManager::Shutdown(); }
+
private:
// Delay in ms between Schedule and actual download.
// This leaves the URL in a queue, which is de-duped, so that there is less
diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc
index 30995a8..05b6475 100644
--- a/net/base/sdch_manager.cc
+++ b/net/base/sdch_manager.cc
@@ -82,6 +82,13 @@ SdchManager::~SdchManager() {
}
// static
+void SdchManager::Shutdown() {
+ if (!global_ )
+ return;
+ global_->fetcher_.reset(NULL);
+}
+
+// static
void SdchManager::BlacklistDomain(const GURL& url) {
if (!global_ )
return;
diff --git a/net/base/sdch_manager.h b/net/base/sdch_manager.h
index e8329e1..43fa484 100644
--- a/net/base/sdch_manager.h
+++ b/net/base/sdch_manager.h
@@ -217,6 +217,9 @@ class SdchManager {
SdchManager();
~SdchManager();
+ // Discontinue fetching of dictionaries, as we're now shutting down.
+ static void Shutdown();
+
// Provide access to the single instance of this class.
static SdchManager* Global();