| OLD | NEW |
| 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 Loading... |
| 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 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 DCHECK(thread_checker_.CalledOnValidThread()); | 1232 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1225 visit_database_observers_.RemoveObserver(observer); | 1233 visit_database_observers_.RemoveObserver(observer); |
| 1226 } | 1234 } |
| 1227 | 1235 |
| 1228 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 1236 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
| 1229 const history::BriefVisitInfo& info) { | 1237 const history::BriefVisitInfo& info) { |
| 1230 DCHECK(thread_checker_.CalledOnValidThread()); | 1238 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1231 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, | 1239 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, |
| 1232 OnAddVisit(info)); | 1240 OnAddVisit(info)); |
| 1233 } | 1241 } |
| 1242 |
| 1243 scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription> |
| 1244 HistoryService::AddFaviconChangedCallback( |
| 1245 const HistoryService::OnFaviconChangedCallback& callback) { |
| 1246 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1247 return favicon_changed_callback_list_.Add(callback); |
| 1248 } |
| 1249 |
| 1250 void HistoryService::NotifyFaviconChanged( |
| 1251 const std::set<GURL>& changed_favicons) { |
| 1252 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1253 favicon_changed_callback_list_.Notify(changed_favicons); |
| 1254 } |
| OLD | NEW |