summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-19 00:20:20 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-19 00:20:20 +0000
commitc0595460c7070a7c7b83bebb9c47b6e3aa540c25 (patch)
tree9b9c96915ed808f780632aa3ade0ceb6562d91c3 /chrome/browser/net
parent5b7c7d3cee3cff13b9fe681b182391e1734833ff (diff)
downloadchromium_src-c0595460c7070a7c7b83bebb9c47b6e3aa540c25.zip
chromium_src-c0595460c7070a7c7b83bebb9c47b6e3aa540c25.tar.gz
chromium_src-c0595460c7070a7c7b83bebb9c47b6e3aa540c25.tar.bz2
Protect dictionary fetch operation in shutdown scenario.
In a shutdown scenario, the default context may already be nulled out, and hence we need to avoid trying to get dictionaries at that late juncture. r=darin Review URL: http://codereview.chromium.org/21462 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9995 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r--chrome/browser/net/sdch_dictionary_fetcher.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/chrome/browser/net/sdch_dictionary_fetcher.cc b/chrome/browser/net/sdch_dictionary_fetcher.cc
index 3a36bde..b063748 100644
--- a/chrome/browser/net/sdch_dictionary_fetcher.cc
+++ b/chrome/browser/net/sdch_dictionary_fetcher.cc
@@ -33,10 +33,19 @@ void SdchDictionaryFetcher::StartFetching() {
DCHECK(task_is_pending_);
task_is_pending_ = false;
+ URLRequestContext* context = Profile::GetDefaultRequestContext();
+ if (!context) {
+ // Shutdown in progress.
+ // Simulate handling of all dictionary requests by clearing queue.
+ while (!fetch_queue_.empty())
+ fetch_queue_.pop();
+ return;
+ }
+
current_fetch_.reset(new URLFetcher(fetch_queue_.front(), URLFetcher::GET,
this));
fetch_queue_.pop();
- current_fetch_->set_request_context(Profile::GetDefaultRequestContext());
+ current_fetch_->set_request_context(context);
current_fetch_->Start();
}