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

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

Issue 349153006: Port HistoryService::QueryRedirects{From,To} to CancelableTaskTracker (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_unittest.cc » ('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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 thread_->message_loop_proxy().get(), 790 thread_->message_loop_proxy().get(),
791 FROM_HERE, 791 FROM_HERE,
792 base::Bind(&HistoryBackend::QueryHistory, 792 base::Bind(&HistoryBackend::QueryHistory,
793 history_backend_.get(), 793 history_backend_.get(),
794 text_query, 794 text_query,
795 options, 795 options,
796 base::Unretained(query_results)), 796 base::Unretained(query_results)),
797 base::Bind(callback, base::Owned(query_results))); 797 base::Bind(callback, base::Owned(query_results)));
798 } 798 }
799 799
800 HistoryService::Handle HistoryService::QueryRedirectsFrom( 800 base::CancelableTaskTracker::TaskId HistoryService::QueryRedirectsFrom(
801 const GURL& from_url, 801 const GURL& from_url,
802 CancelableRequestConsumerBase* consumer, 802 const QueryRedirectsCallback& callback,
803 const QueryRedirectsCallback& callback) { 803 base::CancelableTaskTracker* tracker) {
804 DCHECK(thread_checker_.CalledOnValidThread()); 804 DCHECK(thread_checker_.CalledOnValidThread());
805 return Schedule(PRIORITY_UI, &HistoryBackend::QueryRedirectsFrom, consumer, 805 history::RedirectList* result = new history::RedirectList();
806 new history::QueryRedirectsRequest(callback), from_url); 806 return tracker->PostTaskAndReply(
807 thread_->message_loop_proxy().get(),
808 FROM_HERE,
809 base::Bind(&HistoryBackend::QueryRedirectsFrom,
810 history_backend_.get(),
811 from_url,
812 base::Unretained(result)),
813 base::Bind(callback, base::Owned(result)));
807 } 814 }
808 815
809 HistoryService::Handle HistoryService::QueryRedirectsTo( 816 base::CancelableTaskTracker::TaskId HistoryService::QueryRedirectsTo(
810 const GURL& to_url, 817 const GURL& to_url,
811 CancelableRequestConsumerBase* consumer, 818 const QueryRedirectsCallback& callback,
812 const QueryRedirectsCallback& callback) { 819 base::CancelableTaskTracker* tracker) {
813 DCHECK(thread_checker_.CalledOnValidThread()); 820 DCHECK(thread_checker_.CalledOnValidThread());
814 return Schedule(PRIORITY_NORMAL, &HistoryBackend::QueryRedirectsTo, consumer, 821 history::RedirectList* result = new history::RedirectList();
815 new history::QueryRedirectsRequest(callback), to_url); 822 return tracker->PostTaskAndReply(thread_->message_loop_proxy().get(),
823 FROM_HERE,
824 base::Bind(&HistoryBackend::QueryRedirectsTo,
825 history_backend_.get(),
826 to_url,
827 base::Unretained(result)),
828 base::Bind(callback, base::Owned(result)));
816 } 829 }
817 830
818 HistoryService::Handle HistoryService::GetVisibleVisitCountToHost( 831 HistoryService::Handle HistoryService::GetVisibleVisitCountToHost(
819 const GURL& url, 832 const GURL& url,
820 CancelableRequestConsumerBase* consumer, 833 CancelableRequestConsumerBase* consumer,
821 const GetVisibleVisitCountToHostCallback& callback) { 834 const GetVisibleVisitCountToHostCallback& callback) {
822 DCHECK(thread_checker_.CalledOnValidThread()); 835 DCHECK(thread_checker_.CalledOnValidThread());
823 return Schedule(PRIORITY_UI, &HistoryBackend::GetVisibleVisitCountToHost, 836 return Schedule(PRIORITY_UI, &HistoryBackend::GetVisibleVisitCountToHost,
824 consumer, new history::GetVisibleVisitCountToHostRequest(callback), url); 837 consumer, new history::GetVisibleVisitCountToHostRequest(callback), url);
825 } 838 }
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 DCHECK(thread_checker_.CalledOnValidThread()); 1193 DCHECK(thread_checker_.CalledOnValidThread());
1181 visit_database_observers_.RemoveObserver(observer); 1194 visit_database_observers_.RemoveObserver(observer);
1182 } 1195 }
1183 1196
1184 void HistoryService::NotifyVisitDBObserversOnAddVisit( 1197 void HistoryService::NotifyVisitDBObserversOnAddVisit(
1185 const history::BriefVisitInfo& info) { 1198 const history::BriefVisitInfo& info) {
1186 DCHECK(thread_checker_.CalledOnValidThread()); 1199 DCHECK(thread_checker_.CalledOnValidThread());
1187 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, 1200 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_,
1188 OnAddVisit(info)); 1201 OnAddVisit(info));
1189 } 1202 }
OLDNEW
« no previous file with comments | « chrome/browser/history/history_service.h ('k') | chrome/browser/history/history_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698