| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 void HistoryService::FlushForTest(const base::Closure& flushed) { | 322 void HistoryService::FlushForTest(const base::Closure& flushed) { |
| 323 thread_->task_runner()->PostTaskAndReply( | 323 thread_->task_runner()->PostTaskAndReply( |
| 324 FROM_HERE, base::Bind(&base::DoNothing), flushed); | 324 FROM_HERE, base::Bind(&base::DoNothing), flushed); |
| 325 } | 325 } |
| 326 | 326 |
| 327 void HistoryService::SetOnBackendDestroyTask(const base::Closure& task) { | 327 void HistoryService::SetOnBackendDestroyTask(const base::Closure& task) { |
| 328 DCHECK(thread_) << "History service being called after cleanup"; | 328 DCHECK(thread_) << "History service being called after cleanup"; |
| 329 DCHECK(thread_checker_.CalledOnValidThread()); | 329 DCHECK(thread_checker_.CalledOnValidThread()); |
| 330 ScheduleTask( | 330 ScheduleTask( |
| 331 PRIORITY_NORMAL, | 331 PRIORITY_NORMAL, |
| 332 base::Bind(&HistoryBackend::SetOnBackendDestroyTask, | 332 base::Bind(&HistoryBackend::SetOnBackendDestroyTask, history_backend_, |
| 333 history_backend_, base::MessageLoop::current(), task)); | 333 base::ThreadTaskRunnerHandle::Get(), task)); |
| 334 } | 334 } |
| 335 | 335 |
| 336 void HistoryService::TopHosts(size_t num_hosts, | 336 void HistoryService::TopHosts(size_t num_hosts, |
| 337 const TopHostsCallback& callback) const { | 337 const TopHostsCallback& callback) const { |
| 338 DCHECK(thread_) << "History service being called after cleanup"; | 338 DCHECK(thread_) << "History service being called after cleanup"; |
| 339 DCHECK(thread_checker_.CalledOnValidThread()); | 339 DCHECK(thread_checker_.CalledOnValidThread()); |
| 340 PostTaskAndReplyWithResult( | 340 PostTaskAndReplyWithResult( |
| 341 thread_->task_runner().get(), FROM_HERE, | 341 thread_->task_runner().get(), FROM_HERE, |
| 342 base::Bind(&HistoryBackend::TopHosts, history_backend_, num_hosts), | 342 base::Bind(&HistoryBackend::TopHosts, history_backend_, num_hosts), |
| 343 callback); | 343 callback); |
| (...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 return favicon_changed_callback_list_.Add(callback); | 1141 return favicon_changed_callback_list_.Add(callback); |
| 1142 } | 1142 } |
| 1143 | 1143 |
| 1144 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, | 1144 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
| 1145 const GURL& icon_url) { | 1145 const GURL& icon_url) { |
| 1146 DCHECK(thread_checker_.CalledOnValidThread()); | 1146 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1147 favicon_changed_callback_list_.Notify(page_urls, icon_url); | 1147 favicon_changed_callback_list_.Notify(page_urls, icon_url); |
| 1148 } | 1148 } |
| 1149 | 1149 |
| 1150 } // namespace history | 1150 } // namespace history |
| OLD | NEW |