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

Unified Diff: chrome/browser/history/history_service.cc

Issue 573553004: Eliminate NOTIFICATION_HISTORY_LOADED notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ScopedObserver to InMemoryHistoryBackend,PrerenderLocalPredictor,ChromeTemplateURLServiceClient Created 6 years, 1 month 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
Index: chrome/browser/history/history_service.cc
diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc
index d3c78c672c7fd3f364f44a946bdc4f23deec08ff..ea860614bae271488bf4f517ea544ee2d3b9f20d 100644
--- a/chrome/browser/history/history_service.cc
+++ b/chrome/browser/history/history_service.cc
@@ -888,6 +888,8 @@ void HistoryService::Cleanup() {
return;
}
+ NotifyHistoryServiceBeingDeleted();
+
weak_ptr_factory_.InvalidateWeakPtrs();
// Unload the backend.
@@ -1234,10 +1236,7 @@ void HistoryService::BroadcastNotificationsHelper(
void HistoryService::OnDBLoaded() {
DCHECK(thread_checker_.CalledOnValidThread());
backend_loaded_ = true;
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_HISTORY_LOADED,
- content::Source<Profile>(profile_),
- content::Details<HistoryService>(this));
+ NotifyHistoryServiceLoaded();
}
bool HistoryService::GetRowForURL(const GURL& url, history::URLRow* url_row) {
@@ -1269,6 +1268,18 @@ void HistoryService::NotifyURLsModified(const history::URLRows& changed_urls) {
OnURLsModified(this, changed_urls));
}
+void HistoryService::NotifyHistoryServiceLoaded() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ FOR_EACH_OBSERVER(history::HistoryServiceObserver, observers_,
+ OnHistoryServiceLoaded(this));
+}
+
+void HistoryService::NotifyHistoryServiceBeingDeleted() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ FOR_EACH_OBSERVER(history::HistoryServiceObserver, observers_,
+ HistoryServiceBeingDeleted(this));
+}
+
scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription>
HistoryService::AddFaviconChangedCallback(
const HistoryService::OnFaviconChangedCallback& callback) {

Powered by Google App Engine
This is Rietveld 408576698