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

Side by Side 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: Created 6 years, 3 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // The history system runs on a background thread so that potentially slow 5 // The history system runs on a background thread so that potentially slow
6 // database operations don't delay the browser. This backend processing is 6 // database operations don't delay the browser. This backend processing is
7 // represented by HistoryBackend. The HistoryService's job is to dispatch to 7 // represented by HistoryBackend. The HistoryService's job is to dispatch to
8 // that thread. 8 // that thread.
9 // 9 //
10 // Main thread History thread 10 // Main thread History thread
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 // backend has allocated for us. The receiver of the notification will cast 1192 // backend has allocated for us. The receiver of the notification will cast
1193 // this to the proper type. 1193 // this to the proper type.
1194 content::Details<history::HistoryDetails> det(details.get()); 1194 content::Details<history::HistoryDetails> det(details.get());
1195 1195
1196 content::NotificationService::current()->Notify(type, source, det); 1196 content::NotificationService::current()->Notify(type, source, det);
1197 } 1197 }
1198 1198
1199 void HistoryService::OnDBLoaded() { 1199 void HistoryService::OnDBLoaded() {
1200 DCHECK(thread_checker_.CalledOnValidThread()); 1200 DCHECK(thread_checker_.CalledOnValidThread());
1201 backend_loaded_ = true; 1201 backend_loaded_ = true;
1202 content::NotificationService::current()->Notify( 1202 NotifyHistoryServiceLoaded();
1203 chrome::NOTIFICATION_HISTORY_LOADED,
1204 content::Source<Profile>(profile_),
1205 content::Details<HistoryService>(this));
1206 } 1203 }
1207 1204
1208 bool HistoryService::GetRowForURL(const GURL& url, history::URLRow* url_row) { 1205 bool HistoryService::GetRowForURL(const GURL& url, history::URLRow* url_row) {
1209 DCHECK(thread_checker_.CalledOnValidThread()); 1206 DCHECK(thread_checker_.CalledOnValidThread());
1210 history::URLDatabase* db = InMemoryDatabase(); 1207 history::URLDatabase* db = InMemoryDatabase();
1211 return db && (db->GetRowForURL(url, url_row) != 0); 1208 return db && (db->GetRowForURL(url, url_row) != 0);
1212 } 1209 }
1213 1210
1214 void HistoryService::AddVisitDatabaseObserver( 1211 void HistoryService::AddVisitDatabaseObserver(
1215 history::VisitDatabaseObserver* observer) { 1212 history::VisitDatabaseObserver* observer) {
1216 DCHECK(thread_checker_.CalledOnValidThread()); 1213 DCHECK(thread_checker_.CalledOnValidThread());
1217 visit_database_observers_.AddObserver(observer); 1214 visit_database_observers_.AddObserver(observer);
1218 } 1215 }
1219 1216
1220 void HistoryService::RemoveVisitDatabaseObserver( 1217 void HistoryService::RemoveVisitDatabaseObserver(
1221 history::VisitDatabaseObserver* observer) { 1218 history::VisitDatabaseObserver* observer) {
1222 DCHECK(thread_checker_.CalledOnValidThread()); 1219 DCHECK(thread_checker_.CalledOnValidThread());
1223 visit_database_observers_.RemoveObserver(observer); 1220 visit_database_observers_.RemoveObserver(observer);
1224 } 1221 }
1225 1222
1226 void HistoryService::NotifyVisitDBObserversOnAddVisit( 1223 void HistoryService::NotifyVisitDBObserversOnAddVisit(
1227 const history::BriefVisitInfo& info) { 1224 const history::BriefVisitInfo& info) {
1228 DCHECK(thread_checker_.CalledOnValidThread()); 1225 DCHECK(thread_checker_.CalledOnValidThread());
1229 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, 1226 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_,
1230 OnAddVisit(info)); 1227 OnAddVisit(info));
1231 } 1228 }
1229
1230 void HistoryService::AddHistoryServiceObserver(
sdefresne 2014/10/20 13:15:41 Note: those two methods have been added already. I
nshaik 2014/10/29 08:43:39 Done.
1231 history::HistoryServiceObserver* observer) {
1232 DCHECK(thread_checker_.CalledOnValidThread());
1233 history_service_observers_.AddObserver(observer);
1234 }
1235
1236 void HistoryService::RemoveHistoryServiceObserver(
1237 history::HistoryServiceObserver* observer) {
1238 DCHECK(thread_checker_.CalledOnValidThread());
1239 history_service_observers_.RemoveObserver(observer);
1240 }
1241
1242 void HistoryService::NotifyHistoryServiceLoaded() {
1243 FOR_EACH_OBSERVER(history::HistoryServiceObserver,
1244 history_service_observers_,
1245 HistoryServiceLoaded(this));
1246 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698