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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 DCHECK(thread_checker_.CalledOnValidThread()); | 660 DCHECK(thread_checker_.CalledOnValidThread()); |
661 QueryURLResult* query_url_result = new QueryURLResult(); | 661 QueryURLResult* query_url_result = new QueryURLResult(); |
662 return tracker->PostTaskAndReply( | 662 return tracker->PostTaskAndReply( |
663 after_startup_task_runner_.get(), FROM_HERE, | 663 after_startup_task_runner_.get(), FROM_HERE, |
664 base::Bind(&HistoryBackend::QueryURL, history_backend_.get(), url, | 664 base::Bind(&HistoryBackend::QueryURL, history_backend_.get(), url, |
665 want_visits, base::Unretained(query_url_result)), | 665 want_visits, base::Unretained(query_url_result)), |
666 base::Bind(&RunWithQueryURLResult, callback, | 666 base::Bind(&RunWithQueryURLResult, callback, |
667 base::Owned(query_url_result))); | 667 base::Owned(query_url_result))); |
668 } | 668 } |
669 | 669 |
| 670 // Statistics ------------------------------------------------------------------ |
| 671 base::CancelableTaskTracker::TaskId HistoryService::GetHistoryCount( |
| 672 const GetHistoryCountCallback& callback, |
| 673 base::CancelableTaskTracker* tracker) { |
| 674 DCHECK(thread_) << "History service being called after cleanup"; |
| 675 DCHECK(thread_checker_.CalledOnValidThread()); |
| 676 |
| 677 return tracker->PostTaskAndReplyWithResult( |
| 678 thread_->task_runner().get(), FROM_HERE, |
| 679 base::Bind(&HistoryBackend::GetHistoryCount, history_backend_.get()), |
| 680 callback); |
| 681 } |
| 682 |
670 // Downloads ------------------------------------------------------------------- | 683 // Downloads ------------------------------------------------------------------- |
671 | 684 |
672 // Handle creation of a download by creating an entry in the history service's | 685 // Handle creation of a download by creating an entry in the history service's |
673 // 'downloads' table. | 686 // 'downloads' table. |
674 void HistoryService::CreateDownload( | 687 void HistoryService::CreateDownload( |
675 const DownloadRow& create_info, | 688 const DownloadRow& create_info, |
676 const HistoryService::DownloadCreateCallback& callback) { | 689 const HistoryService::DownloadCreateCallback& callback) { |
677 DCHECK(thread_) << "History service being called after cleanup"; | 690 DCHECK(thread_) << "History service being called after cleanup"; |
678 DCHECK(thread_checker_.CalledOnValidThread()); | 691 DCHECK(thread_checker_.CalledOnValidThread()); |
679 PostTaskAndReplyWithResult(after_startup_task_runner_.get(), FROM_HERE, | 692 PostTaskAndReplyWithResult(after_startup_task_runner_.get(), FROM_HERE, |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 return favicon_changed_callback_list_.Add(callback); | 1185 return favicon_changed_callback_list_.Add(callback); |
1173 } | 1186 } |
1174 | 1187 |
1175 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, | 1188 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
1176 const GURL& icon_url) { | 1189 const GURL& icon_url) { |
1177 DCHECK(thread_checker_.CalledOnValidThread()); | 1190 DCHECK(thread_checker_.CalledOnValidThread()); |
1178 favicon_changed_callback_list_.Notify(page_urls, icon_url); | 1191 favicon_changed_callback_list_.Notify(page_urls, icon_url); |
1179 } | 1192 } |
1180 | 1193 |
1181 } // namespace history | 1194 } // namespace history |
OLD | NEW |