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

Side by Side Diff: components/history/core/browser/history_service.cc

Issue 2423813002: Remove usage of FOR_EACH_OBSERVER macro in components/history (Closed)
Patch Set: explicit type Created 4 years, 2 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 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 DCHECK(thread_checker_.CalledOnValidThread()); 1056 DCHECK(thread_checker_.CalledOnValidThread());
1057 backend_loaded_ = true; 1057 backend_loaded_ = true;
1058 NotifyHistoryServiceLoaded(); 1058 NotifyHistoryServiceLoaded();
1059 } 1059 }
1060 1060
1061 void HistoryService::NotifyURLVisited(ui::PageTransition transition, 1061 void HistoryService::NotifyURLVisited(ui::PageTransition transition,
1062 const URLRow& row, 1062 const URLRow& row,
1063 const RedirectList& redirects, 1063 const RedirectList& redirects,
1064 base::Time visit_time) { 1064 base::Time visit_time) {
1065 DCHECK(thread_checker_.CalledOnValidThread()); 1065 DCHECK(thread_checker_.CalledOnValidThread());
1066 FOR_EACH_OBSERVER(HistoryServiceObserver, observers_, 1066 for (HistoryServiceObserver& observer : observers_)
1067 OnURLVisited(this, transition, row, redirects, visit_time)); 1067 observer.OnURLVisited(this, transition, row, redirects, visit_time);
1068 } 1068 }
1069 1069
1070 void HistoryService::NotifyURLsModified(const URLRows& changed_urls) { 1070 void HistoryService::NotifyURLsModified(const URLRows& changed_urls) {
1071 DCHECK(thread_checker_.CalledOnValidThread()); 1071 DCHECK(thread_checker_.CalledOnValidThread());
1072 FOR_EACH_OBSERVER(HistoryServiceObserver, observers_, 1072 for (HistoryServiceObserver& observer : observers_)
1073 OnURLsModified(this, changed_urls)); 1073 observer.OnURLsModified(this, changed_urls);
1074 } 1074 }
1075 1075
1076 void HistoryService::NotifyURLsDeleted(bool all_history, 1076 void HistoryService::NotifyURLsDeleted(bool all_history,
1077 bool expired, 1077 bool expired,
1078 const URLRows& deleted_rows, 1078 const URLRows& deleted_rows,
1079 const std::set<GURL>& favicon_urls) { 1079 const std::set<GURL>& favicon_urls) {
1080 DCHECK(thread_checker_.CalledOnValidThread()); 1080 DCHECK(thread_checker_.CalledOnValidThread());
1081 if (!thread_) 1081 if (!thread_)
1082 return; 1082 return;
1083 1083
(...skipping 10 matching lines...) Expand all
1094 visit_delegate_->DeleteAllURLs(); 1094 visit_delegate_->DeleteAllURLs();
1095 } else { 1095 } else {
1096 std::vector<GURL> urls; 1096 std::vector<GURL> urls;
1097 urls.reserve(deleted_rows.size()); 1097 urls.reserve(deleted_rows.size());
1098 for (const auto& row : deleted_rows) 1098 for (const auto& row : deleted_rows)
1099 urls.push_back(row.url()); 1099 urls.push_back(row.url());
1100 visit_delegate_->DeleteURLs(urls); 1100 visit_delegate_->DeleteURLs(urls);
1101 } 1101 }
1102 } 1102 }
1103 1103
1104 FOR_EACH_OBSERVER( 1104 for (HistoryServiceObserver& observer : observers_) {
1105 HistoryServiceObserver, observers_, 1105 observer.OnURLsDeleted(this, all_history, expired, deleted_rows,
1106 OnURLsDeleted(this, all_history, expired, deleted_rows, favicon_urls)); 1106 favicon_urls);
1107 }
1107 } 1108 }
1108 1109
1109 void HistoryService::NotifyHistoryServiceLoaded() { 1110 void HistoryService::NotifyHistoryServiceLoaded() {
1110 DCHECK(thread_checker_.CalledOnValidThread()); 1111 DCHECK(thread_checker_.CalledOnValidThread());
1111 FOR_EACH_OBSERVER(HistoryServiceObserver, observers_, 1112 for (HistoryServiceObserver& observer : observers_)
1112 OnHistoryServiceLoaded(this)); 1113 observer.OnHistoryServiceLoaded(this);
1113 } 1114 }
1114 1115
1115 void HistoryService::NotifyHistoryServiceBeingDeleted() { 1116 void HistoryService::NotifyHistoryServiceBeingDeleted() {
1116 DCHECK(thread_checker_.CalledOnValidThread()); 1117 DCHECK(thread_checker_.CalledOnValidThread());
1117 FOR_EACH_OBSERVER(HistoryServiceObserver, observers_, 1118 for (HistoryServiceObserver& observer : observers_)
1118 HistoryServiceBeingDeleted(this)); 1119 observer.HistoryServiceBeingDeleted(this);
1119 } 1120 }
1120 1121
1121 void HistoryService::NotifyKeywordSearchTermUpdated( 1122 void HistoryService::NotifyKeywordSearchTermUpdated(
1122 const URLRow& row, 1123 const URLRow& row,
1123 KeywordID keyword_id, 1124 KeywordID keyword_id,
1124 const base::string16& term) { 1125 const base::string16& term) {
1125 DCHECK(thread_checker_.CalledOnValidThread()); 1126 DCHECK(thread_checker_.CalledOnValidThread());
1126 FOR_EACH_OBSERVER(HistoryServiceObserver, observers_, 1127 for (HistoryServiceObserver& observer : observers_)
1127 OnKeywordSearchTermUpdated(this, row, keyword_id, term)); 1128 observer.OnKeywordSearchTermUpdated(this, row, keyword_id, term);
1128 } 1129 }
1129 1130
1130 void HistoryService::NotifyKeywordSearchTermDeleted(URLID url_id) { 1131 void HistoryService::NotifyKeywordSearchTermDeleted(URLID url_id) {
1131 DCHECK(thread_checker_.CalledOnValidThread()); 1132 DCHECK(thread_checker_.CalledOnValidThread());
1132 FOR_EACH_OBSERVER(HistoryServiceObserver, observers_, 1133 for (HistoryServiceObserver& observer : observers_)
1133 OnKeywordSearchTermDeleted(this, url_id)); 1134 observer.OnKeywordSearchTermDeleted(this, url_id);
1134 } 1135 }
1135 1136
1136 std::unique_ptr< 1137 std::unique_ptr<
1137 base::CallbackList<void(const std::set<GURL>&, const GURL&)>::Subscription> 1138 base::CallbackList<void(const std::set<GURL>&, const GURL&)>::Subscription>
1138 HistoryService::AddFaviconsChangedCallback( 1139 HistoryService::AddFaviconsChangedCallback(
1139 const HistoryService::OnFaviconsChangedCallback& callback) { 1140 const HistoryService::OnFaviconsChangedCallback& callback) {
1140 DCHECK(thread_checker_.CalledOnValidThread()); 1141 DCHECK(thread_checker_.CalledOnValidThread());
1141 return favicon_changed_callback_list_.Add(callback); 1142 return favicon_changed_callback_list_.Add(callback);
1142 } 1143 }
1143 1144
1144 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, 1145 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls,
1145 const GURL& icon_url) { 1146 const GURL& icon_url) {
1146 DCHECK(thread_checker_.CalledOnValidThread()); 1147 DCHECK(thread_checker_.CalledOnValidThread());
1147 favicon_changed_callback_list_.Notify(page_urls, icon_url); 1148 favicon_changed_callback_list_.Notify(page_urls, icon_url);
1148 } 1149 }
1149 1150
1150 } // namespace history 1151 } // namespace history
OLDNEW
« no previous file with comments | « components/history/core/browser/history_backend.cc ('k') | components/history/core/browser/top_sites.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698