Index: chrome/browser/predictors/resource_prefetch_predictor.cc |
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc |
index 76329738d78ca7c27da8d55c8bfa636c3baf9ad5..85b7d80a4eb8efbf175c4e18fddbf39f1522cae4 100644 |
--- a/chrome/browser/predictors/resource_prefetch_predictor.cc |
+++ b/chrome/browser/predictors/resource_prefetch_predictor.cc |
@@ -1106,8 +1106,7 @@ void ResourcePrefetchPredictor::OnURLsDeleted( |
const history::URLRows& deleted_rows, |
const std::set<GURL>& favicon_urls) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
- if (INITIALIZED != initialization_state_) |
- return; |
+ DCHECK(initialization_state_ == INITIALIZED); |
if (all_history) { |
DeleteAllUrls(); |
@@ -1124,8 +1123,9 @@ void ResourcePrefetchPredictor::OnURLsDeleted( |
void ResourcePrefetchPredictor::OnHistoryServiceLoaded( |
history::HistoryService* history_service) { |
- OnHistoryAndCacheLoaded(); |
- history_service_observer_.Remove(history_service); |
+ if (initialization_state_ == INITIALIZING) { |
+ OnHistoryAndCacheLoaded(); |
+ } |
} |
void ResourcePrefetchPredictor::ConnectToHistoryService() { |
@@ -1135,14 +1135,12 @@ void ResourcePrefetchPredictor::ConnectToHistoryService() { |
ServiceAccessType::EXPLICIT_ACCESS); |
if (!history_service) |
return; |
+ DCHECK(!history_service_observer_.IsObserving(history_service)); |
+ history_service_observer_.Add(history_service); |
if (history_service->BackendLoaded()) { |
// HistoryService is already loaded. Continue with Initialization. |
OnHistoryAndCacheLoaded(); |
- return; |
} |
- DCHECK(!history_service_observer_.IsObserving(history_service)); |
- history_service_observer_.Add(history_service); |
- return; |
} |
//////////////////////////////////////////////////////////////////////////////// |