| 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();
|
|
|