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

Unified Diff: chrome/browser/search_engines/template_url_service.cc

Issue 13932025: Cancel pending requests for TemplateURLs in Shutdown, instead of dtor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pure merge Created 7 years, 8 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/search_engines/template_url_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search_engines/template_url_service.cc
diff --git a/chrome/browser/search_engines/template_url_service.cc b/chrome/browser/search_engines/template_url_service.cc
index 912f9b1078b754b9746399600ef56171f7066e4d..1472068b6f181512631b0849a9738a4f8038c19c 100644
--- a/chrome/browser/search_engines/template_url_service.cc
+++ b/chrome/browser/search_engines/template_url_service.cc
@@ -306,12 +306,6 @@ TemplateURLService::TemplateURLService(const Initializer* initializers,
}
TemplateURLService::~TemplateURLService() {
- if (load_handle_) {
- DCHECK(service_.get());
- service_->CancelRequest(load_handle_);
- }
-
- STLDeleteElements(&template_urls_);
}
// static
@@ -878,6 +872,18 @@ void TemplateURLService::Observe(int type,
}
}
+void TemplateURLService::Shutdown() {
+ // This check has to be done at Shutdown() instead of in the dtor to ensure
+ // that no clients of WebDataService are holding ptrs to it after the first
+ // phase of the ProfileKeyedService Shutdown() process.
+ if (load_handle_) {
+ DCHECK(service_.get());
+ service_->CancelRequest(load_handle_);
+ }
+ service_ = NULL;
+ STLDeleteElements(&template_urls_);
+}
+
void TemplateURLService::OnSyncedDefaultSearchProviderGUIDChanged() {
// Listen for changes to the default search from Sync.
PrefService* prefs = GetPrefs();
« no previous file with comments | « chrome/browser/search_engines/template_url_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698