| 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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 // guarantee that the first Bind's arguments are evaluated before the second | 710 // guarantee that the first Bind's arguments are evaluated before the second |
| 711 // Bind's arguments. | 711 // Bind's arguments. |
| 712 backend_task_runner_->PostTaskAndReply( | 712 backend_task_runner_->PostTaskAndReply( |
| 713 FROM_HERE, | 713 FROM_HERE, |
| 714 base::Bind(&HistoryBackend::QueryDownloads, history_backend_, rows), | 714 base::Bind(&HistoryBackend::QueryDownloads, history_backend_, rows), |
| 715 base::Bind(callback, base::Passed(&scoped_rows))); | 715 base::Bind(callback, base::Passed(&scoped_rows))); |
| 716 } | 716 } |
| 717 | 717 |
| 718 // Handle updates for a particular download. This is a 'fire and forget' | 718 // Handle updates for a particular download. This is a 'fire and forget' |
| 719 // operation, so we don't need to be called back. | 719 // operation, so we don't need to be called back. |
| 720 void HistoryService::UpdateDownload(const DownloadRow& data) { | 720 void HistoryService::UpdateDownload( |
| 721 const DownloadRow& data, |
| 722 bool should_commit_immediately) { |
| 721 DCHECK(backend_task_runner_) << "History service being called after cleanup"; | 723 DCHECK(backend_task_runner_) << "History service being called after cleanup"; |
| 722 DCHECK(thread_checker_.CalledOnValidThread()); | 724 DCHECK(thread_checker_.CalledOnValidThread()); |
| 723 ScheduleTask(PRIORITY_NORMAL, base::Bind(&HistoryBackend::UpdateDownload, | 725 ScheduleTask(PRIORITY_NORMAL, base::Bind(&HistoryBackend::UpdateDownload, |
| 724 history_backend_, data)); | 726 history_backend_, data, |
| 727 should_commit_immediately)); |
| 725 } | 728 } |
| 726 | 729 |
| 727 void HistoryService::RemoveDownloads(const std::set<uint32_t>& ids) { | 730 void HistoryService::RemoveDownloads(const std::set<uint32_t>& ids) { |
| 728 DCHECK(backend_task_runner_) << "History service being called after cleanup"; | 731 DCHECK(backend_task_runner_) << "History service being called after cleanup"; |
| 729 DCHECK(thread_checker_.CalledOnValidThread()); | 732 DCHECK(thread_checker_.CalledOnValidThread()); |
| 730 ScheduleTask(PRIORITY_NORMAL, base::Bind(&HistoryBackend::RemoveDownloads, | 733 ScheduleTask(PRIORITY_NORMAL, base::Bind(&HistoryBackend::RemoveDownloads, |
| 731 history_backend_, ids)); | 734 history_backend_, ids)); |
| 732 } | 735 } |
| 733 | 736 |
| 734 base::CancelableTaskTracker::TaskId HistoryService::QueryHistory( | 737 base::CancelableTaskTracker::TaskId HistoryService::QueryHistory( |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 return favicon_changed_callback_list_.Add(callback); | 1147 return favicon_changed_callback_list_.Add(callback); |
| 1145 } | 1148 } |
| 1146 | 1149 |
| 1147 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, | 1150 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
| 1148 const GURL& icon_url) { | 1151 const GURL& icon_url) { |
| 1149 DCHECK(thread_checker_.CalledOnValidThread()); | 1152 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1150 favicon_changed_callback_list_.Notify(page_urls, icon_url); | 1153 favicon_changed_callback_list_.Notify(page_urls, icon_url); |
| 1151 } | 1154 } |
| 1152 | 1155 |
| 1153 } // namespace history | 1156 } // namespace history |
| OLD | NEW |