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 ded4d178be9778a85db793248ddce189d89781de..077547d717bfe25b7ebdff72777b639a7fe989aa 100644 |
--- a/chrome/browser/predictors/resource_prefetch_predictor.cc |
+++ b/chrome/browser/predictors/resource_prefetch_predictor.cc |
@@ -1143,8 +1143,9 @@ void ResourcePrefetchPredictor::OnURLsDeleted( |
void ResourcePrefetchPredictor::OnHistoryServiceLoaded( |
history::HistoryService* history_service) { |
- OnHistoryAndCacheLoaded(); |
- history_service_observer_.Remove(history_service); |
+ if (initialization_state_ == INITIALIZING) { |
+ OnHistoryAndCacheLoaded(); |
pasko
2016/11/29 18:01:00
Would it be possible for HistoryServiceFactory::Ge
dullweber
2016/11/30 11:49:21
I added this check for the same rare reason as for
|
+ } |
} |
void ResourcePrefetchPredictor::ConnectToHistoryService() { |
@@ -1154,14 +1155,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; |
} |
//////////////////////////////////////////////////////////////////////////////// |