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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
648 DCHECK(thread_checker_.CalledOnValidThread()); | 648 DCHECK(thread_checker_.CalledOnValidThread()); |
649 QueryURLResult* query_url_result = new QueryURLResult(); | 649 QueryURLResult* query_url_result = new QueryURLResult(); |
650 return tracker->PostTaskAndReply( | 650 return tracker->PostTaskAndReply( |
651 thread_->task_runner().get(), FROM_HERE, | 651 thread_->task_runner().get(), FROM_HERE, |
652 base::Bind(&HistoryBackend::QueryURL, history_backend_.get(), url, | 652 base::Bind(&HistoryBackend::QueryURL, history_backend_.get(), url, |
653 want_visits, base::Unretained(query_url_result)), | 653 want_visits, base::Unretained(query_url_result)), |
654 base::Bind(&RunWithQueryURLResult, callback, | 654 base::Bind(&RunWithQueryURLResult, callback, |
655 base::Owned(query_url_result))); | 655 base::Owned(query_url_result))); |
656 } | 656 } |
657 | 657 |
658 // Statistics ------------------------------------------------------------------ | |
659 base::CancelableTaskTracker::TaskId HistoryService::CountURLs( | |
660 const CountURLsCallback& callback, | |
lwchkg
2015/08/11 15:54:51
Suggest to rename to GetHistoryCount. Mike and Jam
Mike Lerman
2015/08/13 14:56:33
GetHistoryCount or GetCountHistoryEntries (or simi
| |
661 base::CancelableTaskTracker* tracker) { | |
662 DCHECK(thread_) << "History service being called after cleanup"; | |
663 DCHECK(thread_checker_.CalledOnValidThread()); | |
664 | |
665 return tracker->PostTaskAndReplyWithResult( | |
666 thread_->task_runner().get(), FROM_HERE, | |
667 base::Bind(&HistoryBackend::CountURLs, history_backend_.get()), | |
668 callback); | |
669 } | |
670 | |
658 // Downloads ------------------------------------------------------------------- | 671 // Downloads ------------------------------------------------------------------- |
659 | 672 |
660 // Handle creation of a download by creating an entry in the history service's | 673 // Handle creation of a download by creating an entry in the history service's |
661 // 'downloads' table. | 674 // 'downloads' table. |
662 void HistoryService::CreateDownload( | 675 void HistoryService::CreateDownload( |
663 const DownloadRow& create_info, | 676 const DownloadRow& create_info, |
664 const HistoryService::DownloadCreateCallback& callback) { | 677 const HistoryService::DownloadCreateCallback& callback) { |
665 DCHECK(thread_) << "History service being called after cleanup"; | 678 DCHECK(thread_) << "History service being called after cleanup"; |
666 DCHECK(thread_checker_.CalledOnValidThread()); | 679 DCHECK(thread_checker_.CalledOnValidThread()); |
667 PostTaskAndReplyWithResult(thread_->task_runner().get(), FROM_HERE, | 680 PostTaskAndReplyWithResult(thread_->task_runner().get(), FROM_HERE, |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1139 return favicon_changed_callback_list_.Add(callback); | 1152 return favicon_changed_callback_list_.Add(callback); |
1140 } | 1153 } |
1141 | 1154 |
1142 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, | 1155 void HistoryService::NotifyFaviconsChanged(const std::set<GURL>& page_urls, |
1143 const GURL& icon_url) { | 1156 const GURL& icon_url) { |
1144 DCHECK(thread_checker_.CalledOnValidThread()); | 1157 DCHECK(thread_checker_.CalledOnValidThread()); |
1145 favicon_changed_callback_list_.Notify(page_urls, icon_url); | 1158 favicon_changed_callback_list_.Notify(page_urls, icon_url); |
1146 } | 1159 } |
1147 | 1160 |
1148 } // namespace history | 1161 } // namespace history |
OLD | NEW |