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..cf6a900922a70d2bc72dd1c8f9904d4ca256b725 100644 |
--- a/chrome/browser/predictors/autocomplete_action_predictor.cc |
+++ b/chrome/browser/predictors/autocomplete_action_predictor.cc |
@@ -85,8 +85,8 @@ AutocompleteActionPredictor::AutocompleteActionPredictor(Profile* profile) |
history::HistoryService* history_service = |
HistoryServiceFactory::GetForProfile( |
profile_, ServiceAccessType::EXPLICIT_ACCESS); |
- if (history_service) |
- history_service->InMemoryDatabase(); |
+ DCHECK(history_service); |
+ history_service->InMemoryDatabase(); |
table_ = |
PredictorDatabaseFactory::GetForProfile(profile_)->autocomplete_table(); |
@@ -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); |
+ DCHECK(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() { |