| 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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 | 818 |
| 819 HistoryService::Handle HistoryService::GetVisibleVisitCountToHost( | 819 HistoryService::Handle HistoryService::GetVisibleVisitCountToHost( |
| 820 const GURL& url, | 820 const GURL& url, |
| 821 CancelableRequestConsumerBase* consumer, | 821 CancelableRequestConsumerBase* consumer, |
| 822 const GetVisibleVisitCountToHostCallback& callback) { | 822 const GetVisibleVisitCountToHostCallback& callback) { |
| 823 DCHECK(thread_checker_.CalledOnValidThread()); | 823 DCHECK(thread_checker_.CalledOnValidThread()); |
| 824 return Schedule(PRIORITY_UI, &HistoryBackend::GetVisibleVisitCountToHost, | 824 return Schedule(PRIORITY_UI, &HistoryBackend::GetVisibleVisitCountToHost, |
| 825 consumer, new history::GetVisibleVisitCountToHostRequest(callback), url); | 825 consumer, new history::GetVisibleVisitCountToHostRequest(callback), url); |
| 826 } | 826 } |
| 827 | 827 |
| 828 HistoryService::Handle HistoryService::QueryMostVisitedURLs( | 828 base::CancelableTaskTracker::TaskId HistoryService::QueryMostVisitedURLs( |
| 829 int result_count, | 829 int result_count, |
| 830 int days_back, | 830 int days_back, |
| 831 CancelableRequestConsumerBase* consumer, | 831 const QueryMostVisitedURLsCallback& callback, |
| 832 const QueryMostVisitedURLsCallback& callback) { | 832 base::CancelableTaskTracker* tracker) { |
| 833 DCHECK(thread_checker_.CalledOnValidThread()); | 833 DCHECK(thread_checker_.CalledOnValidThread()); |
| 834 return Schedule(PRIORITY_NORMAL, &HistoryBackend::QueryMostVisitedURLs, | 834 history::MostVisitedURLList* result = new history::MostVisitedURLList(); |
| 835 consumer, | 835 return tracker->PostTaskAndReply( |
| 836 new history::QueryMostVisitedURLsRequest(callback), | 836 thread_->message_loop_proxy().get(), |
| 837 result_count, days_back); | 837 FROM_HERE, |
| 838 base::Bind(&HistoryBackend::QueryMostVisitedURLs, |
| 839 history_backend_.get(), |
| 840 result_count, |
| 841 days_back, |
| 842 base::Unretained(result)), |
| 843 base::Bind(callback, base::Owned(result))); |
| 838 } | 844 } |
| 839 | 845 |
| 840 HistoryService::Handle HistoryService::QueryFilteredURLs( | 846 HistoryService::Handle HistoryService::QueryFilteredURLs( |
| 841 int result_count, | 847 int result_count, |
| 842 const history::VisitFilter& filter, | 848 const history::VisitFilter& filter, |
| 843 bool extended_info, | 849 bool extended_info, |
| 844 CancelableRequestConsumerBase* consumer, | 850 CancelableRequestConsumerBase* consumer, |
| 845 const QueryFilteredURLsCallback& callback) { | 851 const QueryFilteredURLsCallback& callback) { |
| 846 DCHECK(thread_checker_.CalledOnValidThread()); | 852 DCHECK(thread_checker_.CalledOnValidThread()); |
| 847 return Schedule(PRIORITY_NORMAL, | 853 return Schedule(PRIORITY_NORMAL, |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 DCHECK(thread_checker_.CalledOnValidThread()); | 1177 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1172 visit_database_observers_.RemoveObserver(observer); | 1178 visit_database_observers_.RemoveObserver(observer); |
| 1173 } | 1179 } |
| 1174 | 1180 |
| 1175 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 1181 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
| 1176 const history::BriefVisitInfo& info) { | 1182 const history::BriefVisitInfo& info) { |
| 1177 DCHECK(thread_checker_.CalledOnValidThread()); | 1183 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1178 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, | 1184 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, |
| 1179 OnAddVisit(info)); | 1185 OnAddVisit(info)); |
| 1180 } | 1186 } |
| OLD | NEW |