Chromium Code Reviews| 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..2269844a4c80c60552e093775ab6818f80d752c3 100644 |
| --- a/chrome/browser/predictors/resource_prefetch_predictor.cc |
| +++ b/chrome/browser/predictors/resource_prefetch_predictor.cc |
| @@ -1125,8 +1125,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(); |
| @@ -1143,8 +1142,9 @@ void ResourcePrefetchPredictor::OnURLsDeleted( |
| void ResourcePrefetchPredictor::OnHistoryServiceLoaded( |
| history::HistoryService* history_service) { |
| - OnHistoryAndCacheLoaded(); |
| - history_service_observer_.Remove(history_service); |
| + if (initialization_state_ == INITIALIZING) { |
|
pasko
2016/12/12 19:15:43
DCHECK instead?
I cannot see how we can end up wi
dullweber
2016/12/13 15:47:35
Ok, I removed it. The DCHECK() in OnHistoryAndCach
|
| + OnHistoryAndCacheLoaded(); |
| + } |
| } |
| void ResourcePrefetchPredictor::ConnectToHistoryService() { |
| @@ -1154,14 +1154,12 @@ void ResourcePrefetchPredictor::ConnectToHistoryService() { |
| ServiceAccessType::EXPLICIT_ACCESS); |
| if (!history_service) |
|
pasko
2016/12/12 19:15:43
GetForProfile() with EXPLICIT_ACCESS never returns
dullweber
2016/12/13 15:47:35
That's right. I removed the conditions and use a D
pasko
2016/12/15 12:57:35
I was wrong here. Sorry. The history service may g
dullweber
2016/12/15 14:52:18
I reverted DCHECK(history_service) but added the D
|
| 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; |
| } |
| //////////////////////////////////////////////////////////////////////////////// |