| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 history_service_, init_status)); | 112 history_service_, init_status)); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void SetInMemoryBackend(scoped_ptr<InMemoryHistoryBackend> backend) override { | 115 void SetInMemoryBackend(scoped_ptr<InMemoryHistoryBackend> backend) override { |
| 116 // Send the backend to the history service on the main thread. | 116 // Send the backend to the history service on the main thread. |
| 117 service_task_runner_->PostTask( | 117 service_task_runner_->PostTask( |
| 118 FROM_HERE, base::Bind(&HistoryService::SetInMemoryBackend, | 118 FROM_HERE, base::Bind(&HistoryService::SetInMemoryBackend, |
| 119 history_service_, base::Passed(&backend))); | 119 history_service_, base::Passed(&backend))); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void NotifyFaviconChanged(const std::set<GURL>& urls) override { | 122 void NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
| 123 const GURL& icon_url) override { |
| 123 // Send the notification to the history service on the main thread. | 124 // Send the notification to the history service on the main thread. |
| 124 service_task_runner_->PostTask( | 125 service_task_runner_->PostTask( |
| 125 FROM_HERE, base::Bind(&HistoryService::NotifyFaviconChanged, | 126 FROM_HERE, base::Bind(&HistoryService::NotifyFaviconsChanged, |
| 126 history_service_, urls)); | 127 history_service_, page_urls, icon_url)); |
| 127 } | 128 } |
| 128 | 129 |
| 129 void NotifyURLVisited(ui::PageTransition transition, | 130 void NotifyURLVisited(ui::PageTransition transition, |
| 130 const URLRow& row, | 131 const URLRow& row, |
| 131 const RedirectList& redirects, | 132 const RedirectList& redirects, |
| 132 base::Time visit_time) override { | 133 base::Time visit_time) override { |
| 133 service_task_runner_->PostTask( | 134 service_task_runner_->PostTask( |
| 134 FROM_HERE, | 135 FROM_HERE, |
| 135 base::Bind(&HistoryService::NotifyURLVisited, history_service_, | 136 base::Bind(&HistoryService::NotifyURLVisited, history_service_, |
| 136 transition, row, redirects, visit_time)); | 137 transition, row, redirects, visit_time)); |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 FOR_EACH_OBSERVER(HistoryServiceObserver, observers_, | 1124 FOR_EACH_OBSERVER(HistoryServiceObserver, observers_, |
| 1124 OnKeywordSearchTermUpdated(this, row, keyword_id, term)); | 1125 OnKeywordSearchTermUpdated(this, row, keyword_id, term)); |
| 1125 } | 1126 } |
| 1126 | 1127 |
| 1127 void HistoryService::NotifyKeywordSearchTermDeleted(URLID url_id) { | 1128 void HistoryService::NotifyKeywordSearchTermDeleted(URLID url_id) { |
| 1128 DCHECK(thread_checker_.CalledOnValidThread()); | 1129 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1129 FOR_EACH_OBSERVER(HistoryServiceObserver, observers_, | 1130 FOR_EACH_OBSERVER(HistoryServiceObserver, observers_, |
| 1130 OnKeywordSearchTermDeleted(this, url_id)); | 1131 OnKeywordSearchTermDeleted(this, url_id)); |
| 1131 } | 1132 } |
| 1132 | 1133 |
| 1133 scoped_ptr<base::CallbackList<void(const std::set<GURL>&)>::Subscription> | 1134 scoped_ptr<base::CallbackList<void(const std::set<GURL>&, |
| 1134 HistoryService::AddFaviconChangedCallback( | 1135 const GURL&)>::Subscription> |
| 1135 const HistoryService::OnFaviconChangedCallback& callback) { | 1136 HistoryService::AddFaviconsChangedCallback( |
| 1137 const HistoryService::OnFaviconsChangedCallback& callback) { |
| 1136 DCHECK(thread_checker_.CalledOnValidThread()); | 1138 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1137 return favicon_changed_callback_list_.Add(callback); | 1139 return favicon_changed_callback_list_.Add(callback); |
| 1138 } | 1140 } |
| 1139 | 1141 |
| 1140 void HistoryService::NotifyFaviconChanged( | 1142 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
| 1141 const std::set<GURL>& changed_favicons) { | 1143 const GURL& icon_url) { |
| 1142 DCHECK(thread_checker_.CalledOnValidThread()); | 1144 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1143 favicon_changed_callback_list_.Notify(changed_favicons); | 1145 favicon_changed_callback_list_.Notify(page_urls, icon_url); |
| 1144 } | 1146 } |
| 1145 | 1147 |
| 1146 } // namespace history | 1148 } // namespace history |
| OLD | NEW |