Index: chrome/browser/predictors/autocomplete_action_predictor.cc |
diff --git a/chrome/browser/predictors/autocomplete_action_predictor.cc b/chrome/browser/predictors/autocomplete_action_predictor.cc |
index 90fd37d1c6711e49854d7c5977724d415fdc1517..76e996294598308fae1d15e718a70d797a8455d4 100644 |
--- a/chrome/browser/predictors/autocomplete_action_predictor.cc |
+++ b/chrome/browser/predictors/autocomplete_action_predictor.cc |
@@ -442,29 +442,25 @@ void AutocompleteActionPredictor::CreateCaches( |
history::HistoryService* history_service = |
HistoryServiceFactory::GetForProfile(profile_, |
ServiceAccessType::EXPLICIT_ACCESS); |
- if (!TryDeleteOldEntries(history_service)) { |
- // Wait for the notification that the history service is ready and the URL |
- // DB is loaded. |
- if (history_service) |
- history_service_observer_.Add(history_service); |
- } |
+ TryDeleteOldEntries(history_service); |
+ if (history_service) |
+ history_service_observer_.Add(history_service); |
} |
-bool AutocompleteActionPredictor::TryDeleteOldEntries( |
+void AutocompleteActionPredictor::TryDeleteOldEntries( |
history::HistoryService* service) { |
CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
DCHECK(!profile_->IsOffTheRecord()); |
DCHECK(!initialized_); |
if (!service) |
- return false; |
+ return; |
history::URLDatabase* url_db = service->InMemoryDatabase(); |
if (!url_db) |
- return false; |
+ return; |
DeleteOldEntries(url_db); |
- return true; |
} |
void AutocompleteActionPredictor::DeleteOldEntries( |
@@ -569,8 +565,7 @@ void AutocompleteActionPredictor::OnURLsDeleted( |
bool expired, |
const history::URLRows& deleted_rows, |
const std::set<GURL>& favicon_urls) { |
- if (!initialized_) |
- return; |
+ DCHECK(initialized_); |
if (all_history) |
DeleteAllRows(); |
@@ -580,8 +575,8 @@ void AutocompleteActionPredictor::OnURLsDeleted( |
void AutocompleteActionPredictor::OnHistoryServiceLoaded( |
history::HistoryService* history_service) { |
- TryDeleteOldEntries(history_service); |
- history_service_observer_.Remove(history_service); |
+ if (!initialized_) |
+ TryDeleteOldEntries(history_service); |
} |
AutocompleteActionPredictor::TransitionalMatch::TransitionalMatch() { |