Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1087)

Side by Side Diff: chrome/browser/history/history_service.cc

Issue 351053003: Port HistoryService::QueryFilteredURLs to CancelableRequestTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/history/history_service.h ('k') | chrome/browser/history/history_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 thread_->message_loop_proxy().get(), 842 thread_->message_loop_proxy().get(),
843 FROM_HERE, 843 FROM_HERE,
844 base::Bind(&HistoryBackend::QueryMostVisitedURLs, 844 base::Bind(&HistoryBackend::QueryMostVisitedURLs,
845 history_backend_.get(), 845 history_backend_.get(),
846 result_count, 846 result_count,
847 days_back, 847 days_back,
848 base::Unretained(result)), 848 base::Unretained(result)),
849 base::Bind(callback, base::Owned(result))); 849 base::Bind(callback, base::Owned(result)));
850 } 850 }
851 851
852 HistoryService::Handle HistoryService::QueryFilteredURLs( 852 base::CancelableTaskTracker::TaskId HistoryService::QueryFilteredURLs(
853 int result_count, 853 int result_count,
854 const history::VisitFilter& filter, 854 const history::VisitFilter& filter,
855 bool extended_info, 855 bool extended_info,
856 CancelableRequestConsumerBase* consumer, 856 const QueryFilteredURLsCallback& callback,
857 const QueryFilteredURLsCallback& callback) { 857 base::CancelableTaskTracker* tracker) {
858 DCHECK(thread_checker_.CalledOnValidThread()); 858 DCHECK(thread_checker_.CalledOnValidThread());
859 return Schedule(PRIORITY_NORMAL, 859 history::FilteredURLList* result = new history::FilteredURLList();
860 &HistoryBackend::QueryFilteredURLs, 860 return tracker->PostTaskAndReply(
861 consumer, 861 thread_->message_loop_proxy().get(),
862 new history::QueryFilteredURLsRequest(callback), 862 FROM_HERE,
863 result_count, filter, extended_info); 863 base::Bind(&HistoryBackend::QueryFilteredURLs,
864 history_backend_.get(),
865 result_count,
866 filter,
867 extended_info,
868 base::Unretained(result)),
869 base::Bind(callback, base::Owned(result)));
864 } 870 }
865 871
866 void HistoryService::Observe(int type, 872 void HistoryService::Observe(int type,
867 const content::NotificationSource& source, 873 const content::NotificationSource& source,
868 const content::NotificationDetails& details) { 874 const content::NotificationDetails& details) {
869 DCHECK(thread_checker_.CalledOnValidThread()); 875 DCHECK(thread_checker_.CalledOnValidThread());
870 if (!thread_) 876 if (!thread_)
871 return; 877 return;
872 878
873 switch (type) { 879 switch (type) {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 DCHECK(thread_checker_.CalledOnValidThread()); 1184 DCHECK(thread_checker_.CalledOnValidThread());
1179 visit_database_observers_.RemoveObserver(observer); 1185 visit_database_observers_.RemoveObserver(observer);
1180 } 1186 }
1181 1187
1182 void HistoryService::NotifyVisitDBObserversOnAddVisit( 1188 void HistoryService::NotifyVisitDBObserversOnAddVisit(
1183 const history::BriefVisitInfo& info) { 1189 const history::BriefVisitInfo& info) {
1184 DCHECK(thread_checker_.CalledOnValidThread()); 1190 DCHECK(thread_checker_.CalledOnValidThread());
1185 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, 1191 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_,
1186 OnAddVisit(info)); 1192 OnAddVisit(info));
1187 } 1193 }
OLDNEW
« no previous file with comments | « chrome/browser/history/history_service.h ('k') | chrome/browser/history/history_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698