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