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

Unified Diff: chrome/browser/predictors/resource_prefetch_predictor.cc

Issue 2538763002: Data from the autocomplete predictor wasn't deleted immediately when deleting browsing history. (Closed)
Patch Set: fix destruction order Created 4 years 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/predictors/autocomplete_action_predictor_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « chrome/browser/predictors/autocomplete_action_predictor_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698