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

Unified Diff: chrome/browser/history/history_service.cc

Issue 314293005: Change HistoryService::QueryURL to use CancelableTaskTracker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and add comment for scoped_ptr usage 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/history_service.cc
diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc
index 1a3ac9ebd178fb01561d9320731ab51407260dd3..ebff8897c70ad06f884477f4ed50e45e6f82db64 100644
--- a/chrome/browser/history/history_service.cc
+++ b/chrome/browser/history/history_service.cc
@@ -80,6 +80,11 @@ void RunWithFaviconResult(const favicon_base::FaviconRawCallback& callback,
callback.Run(*bitmap_result);
}
+void RunWithQueryURLResult(const HistoryService::QueryURLCallback& callback,
+ const HistoryBackend::QueryURLResult& result) {
+ callback.Run(result.success, result.row, result.visits);
+}
+
// Extract history::URLRows into GURLs for VisitedLinkMaster.
class URLIteratorFromURLRows
: public visitedlink::VisitedLinkMaster::URLIterator {
@@ -703,14 +708,18 @@ void HistoryService::SetImportedFavicons(
&HistoryBackend::SetImportedFavicons, favicon_usage);
}
-HistoryService::Handle HistoryService::QueryURL(
+base::CancelableTaskTracker::TaskId HistoryService::QueryURL(
const GURL& url,
bool want_visits,
- CancelableRequestConsumerBase* consumer,
- const QueryURLCallback& callback) {
+ const QueryURLCallback& callback,
+ base::CancelableTaskTracker* tracker) {
DCHECK(thread_checker_.CalledOnValidThread());
- return Schedule(PRIORITY_UI, &HistoryBackend::QueryURL, consumer,
- new history::QueryURLRequest(callback), url, want_visits);
+ return PostTaskAndReplyWithResult(
+ thread_->message_loop_proxy().get(),
+ FROM_HERE,
+ base::Bind(
+ &HistoryBackend::QueryURL, history_backend_.get(), url, want_visits),
+ base::Bind(&RunWithQueryURLResult, callback));
}
// Downloads -------------------------------------------------------------------

Powered by Google App Engine
This is Rietveld 408576698