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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 } | 300 } |
301 | 301 |
302 base::CancelableTaskTracker::TaskId HistoryService::ScheduleDBTask( | 302 base::CancelableTaskTracker::TaskId HistoryService::ScheduleDBTask( |
303 std::unique_ptr<HistoryDBTask> task, | 303 std::unique_ptr<HistoryDBTask> task, |
304 base::CancelableTaskTracker* tracker) { | 304 base::CancelableTaskTracker* tracker) { |
305 DCHECK(thread_) << "History service being called after cleanup"; | 305 DCHECK(thread_) << "History service being called after cleanup"; |
306 DCHECK(thread_checker_.CalledOnValidThread()); | 306 DCHECK(thread_checker_.CalledOnValidThread()); |
307 base::CancelableTaskTracker::IsCanceledCallback is_canceled; | 307 base::CancelableTaskTracker::IsCanceledCallback is_canceled; |
308 base::CancelableTaskTracker::TaskId task_id = | 308 base::CancelableTaskTracker::TaskId task_id = |
309 tracker->NewTrackedTaskId(&is_canceled); | 309 tracker->NewTrackedTaskId(&is_canceled); |
310 // Use base::ThreadTaskRunnerHandler::Get() to get a message loop proxy to | 310 // Use base::ThreadTaskRunnerHandler::Get() to get a task runner for |
311 // the current message loop so that we can forward the call to the method | 311 // the current message loop so that we can forward the call to the method |
312 // HistoryDBTask::DoneRunOnMainThread() in the correct thread. | 312 // HistoryDBTask::DoneRunOnMainThread() in the correct thread. |
313 thread_->task_runner()->PostTask( | 313 thread_->task_runner()->PostTask( |
314 FROM_HERE, base::Bind(&HistoryBackend::ProcessDBTask, | 314 FROM_HERE, base::Bind(&HistoryBackend::ProcessDBTask, |
315 history_backend_.get(), base::Passed(&task), | 315 history_backend_.get(), base::Passed(&task), |
316 base::ThreadTaskRunnerHandle::Get(), is_canceled)); | 316 base::ThreadTaskRunnerHandle::Get(), is_canceled)); |
317 return task_id; | 317 return task_id; |
318 } | 318 } |
319 | 319 |
320 void HistoryService::FlushForTest(const base::Closure& flushed) { | 320 void HistoryService::FlushForTest(const base::Closure& flushed) { |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 return favicon_changed_callback_list_.Add(callback); | 1132 return favicon_changed_callback_list_.Add(callback); |
1133 } | 1133 } |
1134 | 1134 |
1135 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, | 1135 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
1136 const GURL& icon_url) { | 1136 const GURL& icon_url) { |
1137 DCHECK(thread_checker_.CalledOnValidThread()); | 1137 DCHECK(thread_checker_.CalledOnValidThread()); |
1138 favicon_changed_callback_list_.Notify(page_urls, icon_url); | 1138 favicon_changed_callback_list_.Notify(page_urls, icon_url); |
1139 } | 1139 } |
1140 | 1140 |
1141 } // namespace history | 1141 } // namespace history |
OLD | NEW |