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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 // the current message loop so that we can forward the call to the method | 338 // the current message loop so that we can forward the call to the method |
339 // HistoryDBTask::DoneRunOnMainThread() in the correct thread. | 339 // HistoryDBTask::DoneRunOnMainThread() in the correct thread. |
340 after_startup_task_runner_->PostTask( | 340 after_startup_task_runner_->PostTask( |
341 FROM_HERE, base::Bind(&HistoryBackend::ProcessDBTask, | 341 FROM_HERE, base::Bind(&HistoryBackend::ProcessDBTask, |
342 history_backend_.get(), base::Passed(&task), | 342 history_backend_.get(), base::Passed(&task), |
343 base::ThreadTaskRunnerHandle::Get(), is_canceled)); | 343 base::ThreadTaskRunnerHandle::Get(), is_canceled)); |
344 return task_id; | 344 return task_id; |
345 } | 345 } |
346 | 346 |
347 void HistoryService::FlushForTest(const base::Closure& flushed) { | 347 void HistoryService::FlushForTest(const base::Closure& flushed) { |
348 after_startup_task_runner_->PostTaskAndReply( | 348 PostTaskAndReplyForTest(base::Bind(&base::DoNothing), flushed); |
349 FROM_HERE, base::Bind(&base::DoNothing), flushed); | 349 } |
| 350 |
| 351 bool HistoryService::PostTaskAndReplyForTest(const base::Closure& task, |
| 352 const base::Closure& reply) { |
| 353 return after_startup_task_runner_->PostTaskAndReply(FROM_HERE, task, reply); |
350 } | 354 } |
351 | 355 |
352 void HistoryService::SetOnBackendDestroyTask(const base::Closure& task) { | 356 void HistoryService::SetOnBackendDestroyTask(const base::Closure& task) { |
353 DCHECK(thread_) << "History service being called after cleanup"; | 357 DCHECK(thread_) << "History service being called after cleanup"; |
354 DCHECK(thread_checker_.CalledOnValidThread()); | 358 DCHECK(thread_checker_.CalledOnValidThread()); |
355 ScheduleTask( | 359 ScheduleTask( |
356 PRIORITY_NORMAL, | 360 PRIORITY_NORMAL, |
357 base::Bind(&HistoryBackend::SetOnBackendDestroyTask, | 361 base::Bind(&HistoryBackend::SetOnBackendDestroyTask, |
358 history_backend_.get(), base::MessageLoop::current(), task)); | 362 history_backend_.get(), base::MessageLoop::current(), task)); |
359 } | 363 } |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 return favicon_changed_callback_list_.Add(callback); | 1195 return favicon_changed_callback_list_.Add(callback); |
1192 } | 1196 } |
1193 | 1197 |
1194 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, | 1198 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
1195 const GURL& icon_url) { | 1199 const GURL& icon_url) { |
1196 DCHECK(thread_checker_.CalledOnValidThread()); | 1200 DCHECK(thread_checker_.CalledOnValidThread()); |
1197 favicon_changed_callback_list_.Notify(page_urls, icon_url); | 1201 favicon_changed_callback_list_.Notify(page_urls, icon_url); |
1198 } | 1202 } |
1199 | 1203 |
1200 } // namespace history | 1204 } // namespace history |
OLD | NEW |