| 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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 thread_->message_loop_proxy().get(), | 864 thread_->message_loop_proxy().get(), |
| 865 FROM_HERE, | 865 FROM_HERE, |
| 866 base::Bind(&HistoryBackend::QueryMostVisitedURLs, | 866 base::Bind(&HistoryBackend::QueryMostVisitedURLs, |
| 867 history_backend_.get(), | 867 history_backend_.get(), |
| 868 result_count, | 868 result_count, |
| 869 days_back, | 869 days_back, |
| 870 base::Unretained(result)), | 870 base::Unretained(result)), |
| 871 base::Bind(callback, base::Owned(result))); | 871 base::Bind(callback, base::Owned(result))); |
| 872 } | 872 } |
| 873 | 873 |
| 874 HistoryService::Handle HistoryService::QueryFilteredURLs( | 874 base::CancelableTaskTracker::TaskId HistoryService::QueryFilteredURLs( |
| 875 int result_count, | 875 int result_count, |
| 876 const history::VisitFilter& filter, | 876 const history::VisitFilter& filter, |
| 877 bool extended_info, | 877 bool extended_info, |
| 878 CancelableRequestConsumerBase* consumer, | 878 const QueryFilteredURLsCallback& callback, |
| 879 const QueryFilteredURLsCallback& callback) { | 879 base::CancelableTaskTracker* tracker) { |
| 880 DCHECK(thread_checker_.CalledOnValidThread()); | 880 DCHECK(thread_checker_.CalledOnValidThread()); |
| 881 return Schedule(PRIORITY_NORMAL, | 881 history::FilteredURLList* result = new history::FilteredURLList(); |
| 882 &HistoryBackend::QueryFilteredURLs, | 882 return tracker->PostTaskAndReply( |
| 883 consumer, | 883 thread_->message_loop_proxy().get(), |
| 884 new history::QueryFilteredURLsRequest(callback), | 884 FROM_HERE, |
| 885 result_count, filter, extended_info); | 885 base::Bind(&HistoryBackend::QueryFilteredURLs, |
| 886 history_backend_.get(), |
| 887 result_count, |
| 888 filter, |
| 889 extended_info, |
| 890 base::Unretained(result)), |
| 891 base::Bind(callback, base::Owned(result))); |
| 886 } | 892 } |
| 887 | 893 |
| 888 void HistoryService::Observe(int type, | 894 void HistoryService::Observe(int type, |
| 889 const content::NotificationSource& source, | 895 const content::NotificationSource& source, |
| 890 const content::NotificationDetails& details) { | 896 const content::NotificationDetails& details) { |
| 891 DCHECK(thread_checker_.CalledOnValidThread()); | 897 DCHECK(thread_checker_.CalledOnValidThread()); |
| 892 if (!thread_) | 898 if (!thread_) |
| 893 return; | 899 return; |
| 894 | 900 |
| 895 switch (type) { | 901 switch (type) { |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 DCHECK(thread_checker_.CalledOnValidThread()); | 1211 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1206 visit_database_observers_.RemoveObserver(observer); | 1212 visit_database_observers_.RemoveObserver(observer); |
| 1207 } | 1213 } |
| 1208 | 1214 |
| 1209 void HistoryService::NotifyVisitDBObserversOnAddVisit( | 1215 void HistoryService::NotifyVisitDBObserversOnAddVisit( |
| 1210 const history::BriefVisitInfo& info) { | 1216 const history::BriefVisitInfo& info) { |
| 1211 DCHECK(thread_checker_.CalledOnValidThread()); | 1217 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1212 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, | 1218 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, |
| 1213 OnAddVisit(info)); | 1219 OnAddVisit(info)); |
| 1214 } | 1220 } |
| OLD | NEW |