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

Unified Diff: chrome/browser/safe_browsing/download_protection_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, 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/safe_browsing/download_protection_service.cc
diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc
index 256aba66fa20b296964bd1280e4f38256b758fe8..9472fd7ba2d461239cd95bfd190e086e7cfa9b9b 100644
--- a/chrome/browser/safe_browsing/download_protection_service.cc
+++ b/chrome/browser/safe_browsing/download_protection_service.cc
@@ -16,6 +16,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
+#include "base/task/cancelable_task_tracker.h"
#include "base/threading/sequenced_worker_pool.h"
#include "base/time/time.h"
#include "chrome/browser/history/history_service.h"
@@ -645,24 +646,20 @@ class DownloadProtectionService::CheckClientDownloadRequest
history->QueryRedirectsTo(
tab_url_,
- &request_consumer_,
base::Bind(&CheckClientDownloadRequest::OnGotTabRedirects,
- base::Unretained(this)));
+ base::Unretained(this),
+ tab_url_),
+ &request_tracker_);
}
- void OnGotTabRedirects(HistoryService::Handle handle,
- GURL url,
- bool success,
- history::RedirectList* redirect_list) {
+ void OnGotTabRedirects(const GURL& url,
+ const history::RedirectList* redirect_list) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_EQ(url, tab_url_);
- if (success && redirect_list->size() > 0) {
- for (history::RedirectList::reverse_iterator i = redirect_list->rbegin();
- i != redirect_list->rend();
- ++i) {
- tab_redirects_.push_back(*i);
- }
+ if (!redirect_list->empty()) {
+ tab_redirects_.insert(
+ tab_redirects_.end(), redirect_list->rbegin(), redirect_list->rend());
}
SendRequest();
@@ -865,7 +862,7 @@ class DownloadProtectionService::CheckClientDownloadRequest
bool finished_;
ClientDownloadRequest::DownloadType type_;
std::string client_download_request_data_;
- CancelableRequestConsumer request_consumer_; // For HistoryService lookup.
+ base::CancelableTaskTracker request_tracker_; // For HistoryService lookup.
base::WeakPtrFactory<CheckClientDownloadRequest> weakptr_factory_;
base::TimeTicks start_time_; // Used for stats.
base::TimeTicks timeout_start_time_;
« no previous file with comments | « chrome/browser/history/redirect_browsertest.cc ('k') | chrome/browser/safe_browsing/malware_details_history.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698