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

Unified Diff: chrome/browser/history/history_backend.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_backend.cc
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index a3fb38f409a0820f40588c851b7b4924b3cd26af..b2c0c69d47316b07f3748b8b4663814d6475321e 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -152,6 +152,14 @@ class CommitLaterTask : public base::RefCounted<CommitLaterTask> {
scoped_refptr<HistoryBackend> history_backend_;
};
+// HistoryBackend::QueryURLResult ----------------------------------------------
+
+HistoryBackend::QueryURLResult::QueryURLResult() : success(false) {
+}
+
+HistoryBackend::QueryURLResult::~QueryURLResult() {
+}
+
// HistoryBackend --------------------------------------------------------------
HistoryBackend::HistoryBackend(const base::FilePath& history_dir,
@@ -988,26 +996,15 @@ bool HistoryBackend::GetURL(const GURL& url, history::URLRow* url_row) {
return false;
}
-void HistoryBackend::QueryURL(scoped_refptr<QueryURLRequest> request,
- const GURL& url,
- bool want_visits) {
- if (request->canceled())
- return;
-
- bool success = false;
- URLRow* row = &request->value.a;
- VisitVector* visits = &request->value.b;
- if (db_) {
- if (db_->GetRowForURL(url, row)) {
- // Have a row.
- success = true;
-
- // Optionally query the visits.
- if (want_visits)
- db_->GetVisitsForURL(row->id(), visits);
- }
+HistoryBackend::QueryURLResult HistoryBackend::QueryURL(const GURL& url,
+ bool want_visits) {
+ QueryURLResult result;
+ result.success = db_ && db_->GetRowForURL(url, &result.row);
+ // Optionally query the visits.
+ if (result.success && want_visits) {
Scott Hess - ex-Googler 2014/06/12 18:04:35 Can drop the {} to be consistent with the style in
+ db_->GetVisitsForURL(result.row.id(), &result.visits);
}
- request->ForwardResult(request->handle(), success, row, visits);
+ return result;
}
TypedUrlSyncableService* HistoryBackend::GetTypedUrlSyncableService() const {

Powered by Google App Engine
This is Rietveld 408576698