| 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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 FROM_HERE, | 858 FROM_HERE, |
| 859 base::Bind(&HistoryBackend::GetVisibleVisitCountToHost, | 859 base::Bind(&HistoryBackend::GetVisibleVisitCountToHost, |
| 860 history_backend_.get(), | 860 history_backend_.get(), |
| 861 url, | 861 url, |
| 862 base::Unretained(result)), | 862 base::Unretained(result)), |
| 863 base::Bind(&RunWithVisibleVisitCountToHostResult, | 863 base::Bind(&RunWithVisibleVisitCountToHostResult, |
| 864 callback, | 864 callback, |
| 865 base::Owned(result))); | 865 base::Owned(result))); |
| 866 } | 866 } |
| 867 | 867 |
| 868 HistoryService::Handle HistoryService::QueryMostVisitedURLs( | 868 base::CancelableTaskTracker::TaskId HistoryService::QueryMostVisitedURLs( |
| 869 int result_count, | 869 int result_count, |
| 870 int days_back, | 870 int days_back, |
| 871 CancelableRequestConsumerBase* consumer, | 871 const QueryMostVisitedURLsCallback& callback, |
| 872 const QueryMostVisitedURLsCallback& callback) { | 872 base::CancelableTaskTracker* tracker) { |
| 873 DCHECK(thread_checker_.CalledOnValidThread()); | 873 DCHECK(thread_checker_.CalledOnValidThread()); |
| 874 return Schedule(PRIORITY_NORMAL, &HistoryBackend::QueryMostVisitedURLs, | 874 history::MostVisitedURLList* result = new history::MostVisitedURLList(); |
| 875 consumer, | 875 return tracker->PostTaskAndReply( |
| 876 new history::QueryMostVisitedURLsRequest(callback), | 876 thread_->message_loop_proxy().get(), |
| 877 result_count, days_back); | 877 FROM_HERE, |
| 878 base::Bind(&HistoryBackend::QueryMostVisitedURLs, |
| 879 history_backend_.get(), |
| 880 result_count, |
| 881 days_back, |
| 882 base::Unretained(result)), |
| 883 base::Bind(callback, base::Owned(result))); |
| 878 } | 884 } |
| 879 | 885 |
| 880 HistoryService::Handle HistoryService::QueryFilteredURLs( | 886 HistoryService::Handle HistoryService::QueryFilteredURLs( |
| 881 int result_count, | 887 int result_count, |
| 882 const history::VisitFilter& filter, | 888 const history::VisitFilter& filter, |
| 883 bool extended_info, | 889 bool extended_info, |
| 884 CancelableRequestConsumerBase* consumer, | 890 CancelableRequestConsumerBase* consumer, |
| 885 const QueryFilteredURLsCallback& callback) { | 891 const QueryFilteredURLsCallback& callback) { |
| 886 DCHECK(thread_checker_.CalledOnValidThread()); | 892 DCHECK(thread_checker_.CalledOnValidThread()); |
| 887 return Schedule(PRIORITY_NORMAL, | 893 return Schedule(PRIORITY_NORMAL, |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 DCHECK(thread_checker_.CalledOnValidThread()); | 1217 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1212 visit_database_observers_.RemoveObserver(observer); | 1218 visit_database_observers_.RemoveObserver(observer); |
| 1213 } | 1219 } |
| 1214 | 1220 |
| 1215 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 1221 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
| 1216 const history::BriefVisitInfo& info) { | 1222 const history::BriefVisitInfo& info) { |
| 1217 DCHECK(thread_checker_.CalledOnValidThread()); | 1223 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1218 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, | 1224 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, |
| 1219 OnAddVisit(info)); | 1225 OnAddVisit(info)); |
| 1220 } | 1226 } |
| OLD | NEW |