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

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

Issue 351363002: Revert of Port HistoryService::GetVisibleVisitCountToHost to CancelableTaskTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 const favicon_base::FaviconRawBitmapCallback& callback, 81 const favicon_base::FaviconRawBitmapCallback& callback,
82 favicon_base::FaviconRawBitmapResult* bitmap_result) { 82 favicon_base::FaviconRawBitmapResult* bitmap_result) {
83 callback.Run(*bitmap_result); 83 callback.Run(*bitmap_result);
84 } 84 }
85 85
86 void RunWithQueryURLResult(const HistoryService::QueryURLCallback& callback, 86 void RunWithQueryURLResult(const HistoryService::QueryURLCallback& callback,
87 const history::QueryURLResult* result) { 87 const history::QueryURLResult* result) {
88 callback.Run(result->success, result->row, result->visits); 88 callback.Run(result->success, result->row, result->visits);
89 } 89 }
90 90
91 void RunWithVisibleVisitCountToHostResult(
92 const HistoryService::GetVisibleVisitCountToHostCallback& callback,
93 const history::VisibleVisitCountToHostResult* result) {
94 callback.Run(result->success, result->count, result->first_visit);
95 }
96
97 // Extract history::URLRows into GURLs for VisitedLinkMaster. 91 // Extract history::URLRows into GURLs for VisitedLinkMaster.
98 class URLIteratorFromURLRows 92 class URLIteratorFromURLRows
99 : public visitedlink::VisitedLinkMaster::URLIterator { 93 : public visitedlink::VisitedLinkMaster::URLIterator {
100 public: 94 public:
101 explicit URLIteratorFromURLRows(const history::URLRows& url_rows) 95 explicit URLIteratorFromURLRows(const history::URLRows& url_rows)
102 : itr_(url_rows.begin()), 96 : itr_(url_rows.begin()),
103 end_(url_rows.end()) { 97 end_(url_rows.end()) {
104 } 98 }
105 99
106 virtual const GURL& NextURL() OVERRIDE { 100 virtual const GURL& NextURL() OVERRIDE {
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 history::RedirectList* result = new history::RedirectList(); 822 history::RedirectList* result = new history::RedirectList();
829 return tracker->PostTaskAndReply(thread_->message_loop_proxy().get(), 823 return tracker->PostTaskAndReply(thread_->message_loop_proxy().get(),
830 FROM_HERE, 824 FROM_HERE,
831 base::Bind(&HistoryBackend::QueryRedirectsTo, 825 base::Bind(&HistoryBackend::QueryRedirectsTo,
832 history_backend_.get(), 826 history_backend_.get(),
833 to_url, 827 to_url,
834 base::Unretained(result)), 828 base::Unretained(result)),
835 base::Bind(callback, base::Owned(result))); 829 base::Bind(callback, base::Owned(result)));
836 } 830 }
837 831
838 base::CancelableTaskTracker::TaskId HistoryService::GetVisibleVisitCountToHost( 832 HistoryService::Handle HistoryService::GetVisibleVisitCountToHost(
839 const GURL& url, 833 const GURL& url,
840 const GetVisibleVisitCountToHostCallback& callback, 834 CancelableRequestConsumerBase* consumer,
841 base::CancelableTaskTracker* tracker) { 835 const GetVisibleVisitCountToHostCallback& callback) {
842 DCHECK(thread_checker_.CalledOnValidThread()); 836 DCHECK(thread_checker_.CalledOnValidThread());
843 history::VisibleVisitCountToHostResult* result = 837 return Schedule(PRIORITY_UI, &HistoryBackend::GetVisibleVisitCountToHost,
844 new history::VisibleVisitCountToHostResult(); 838 consumer, new history::GetVisibleVisitCountToHostRequest(callback), url);
845 return tracker->PostTaskAndReply(
846 thread_->message_loop_proxy().get(),
847 FROM_HERE,
848 base::Bind(&HistoryBackend::GetVisibleVisitCountToHost,
849 history_backend_.get(),
850 url,
851 base::Unretained(result)),
852 base::Bind(&RunWithVisibleVisitCountToHostResult,
853 callback,
854 base::Owned(result)));
855 } 839 }
856 840
857 HistoryService::Handle HistoryService::QueryTopURLsAndRedirects( 841 HistoryService::Handle HistoryService::QueryTopURLsAndRedirects(
858 int result_count, 842 int result_count,
859 CancelableRequestConsumerBase* consumer, 843 CancelableRequestConsumerBase* consumer,
860 const QueryTopURLsAndRedirectsCallback& callback) { 844 const QueryTopURLsAndRedirectsCallback& callback) {
861 DCHECK(thread_checker_.CalledOnValidThread()); 845 DCHECK(thread_checker_.CalledOnValidThread());
862 return Schedule(PRIORITY_NORMAL, &HistoryBackend::QueryTopURLsAndRedirects, 846 return Schedule(PRIORITY_NORMAL, &HistoryBackend::QueryTopURLsAndRedirects,
863 consumer, new history::QueryTopURLsAndRedirectsRequest(callback), 847 consumer, new history::QueryTopURLsAndRedirectsRequest(callback),
864 result_count); 848 result_count);
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 DCHECK(thread_checker_.CalledOnValidThread()); 1194 DCHECK(thread_checker_.CalledOnValidThread());
1211 visit_database_observers_.RemoveObserver(observer); 1195 visit_database_observers_.RemoveObserver(observer);
1212 } 1196 }
1213 1197
1214 void HistoryService::NotifyVisitDBObserversOnAddVisit( 1198 void HistoryService::NotifyVisitDBObserversOnAddVisit(
1215 const history::BriefVisitInfo& info) { 1199 const history::BriefVisitInfo& info) {
1216 DCHECK(thread_checker_.CalledOnValidThread()); 1200 DCHECK(thread_checker_.CalledOnValidThread());
1217 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_, 1201 FOR_EACH_OBSERVER(history::VisitDatabaseObserver, visit_database_observers_,
1218 OnAddVisit(info)); 1202 OnAddVisit(info));
1219 } 1203 }
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