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

Side by Side Diff: chrome/browser/history/history_service.cc

Issue 484213002: Refactor HistoryService to not send NOTIFICATION_FAVICON_CHANGED (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix android compilation Created 6 years, 4 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 | Annotate | Revision Log
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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 virtual void SetInMemoryBackend( 152 virtual void SetInMemoryBackend(
153 scoped_ptr<history::InMemoryHistoryBackend> backend) OVERRIDE { 153 scoped_ptr<history::InMemoryHistoryBackend> backend) OVERRIDE {
154 // Send the backend to the history service on the main thread. 154 // Send the backend to the history service on the main thread.
155 service_task_runner_->PostTask( 155 service_task_runner_->PostTask(
156 FROM_HERE, 156 FROM_HERE,
157 base::Bind(&HistoryService::SetInMemoryBackend, history_service_, 157 base::Bind(&HistoryService::SetInMemoryBackend, history_service_,
158 base::Passed(&backend))); 158 base::Passed(&backend)));
159 } 159 }
160 160
161 virtual void NotifyFaviconChanged(const std::set<GURL>& urls) OVERRIDE {
162 // Send the notification to the history service on the main thread.
163 service_task_runner_->PostTask(
164 FROM_HERE,
165 base::Bind(
166 &HistoryService::NotifyFaviconChanged, history_service_, urls));
167 }
168
161 virtual void BroadcastNotifications( 169 virtual void BroadcastNotifications(
162 int type, 170 int type,
163 scoped_ptr<history::HistoryDetails> details) OVERRIDE { 171 scoped_ptr<history::HistoryDetails> details) OVERRIDE {
164 // Send the notification on the history thread. 172 // Send the notification on the history thread.
165 if (content::NotificationService::current()) { 173 if (content::NotificationService::current()) {
166 content::Details<history::HistoryDetails> det(details.get()); 174 content::Details<history::HistoryDetails> det(details.get());
167 content::NotificationService::current()->Notify( 175 content::NotificationService::current()->Notify(
168 type, content::Source<Profile>(profile_), det); 176 type, content::Source<Profile>(profile_), det);
169 } 177 }
170 // Send the notification to the history service on the main thread. 178 // Send the notification to the history service on the main thread.
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 DCHECK(thread_checker_.CalledOnValidThread()); 1230 DCHECK(thread_checker_.CalledOnValidThread());
1223 visit_database_observers_.RemoveObserver(observer); 1231 visit_database_observers_.RemoveObserver(observer);
1224 } 1232 }
1225 1233
1226 void HistoryService::NotifyVisitDBObserversOnAddVisit( 1234 void HistoryService::NotifyVisitDBObserversOnAddVisit(
1227 const history::BriefVisitInfo& info) { 1235 const history::BriefVisitInfo& info) {
1228 DCHECK(thread_checker_.CalledOnValidThread()); 1236 DCHECK(thread_checker_.CalledOnValidThread());
1229 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, 1237 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_,
1230 OnAddVisit(info)); 1238 OnAddVisit(info));
1231 } 1239 }
1240
1241 scoped_ptr<base::CallbackList<
1242 void(HistoryService*, const std::set<GURL>&)>::Subscription>
1243 HistoryService::AddFaviconChangedCallback(
1244 const HistoryService::OnFaviconChangedCallback& callback) {
1245 DCHECK(thread_checker_.CalledOnValidThread());
1246 return favicon_changed_callback_list_.Add(callback);
1247 }
1248
1249 void HistoryService::NotifyFaviconChanged(
1250 const std::set<GURL>& changed_favicons) {
1251 DCHECK(thread_checker_.CalledOnValidThread());
1252 favicon_changed_callback_list_.Notify(this, changed_favicons);
1253 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698