Chromium Code Reviews| Index: chrome/browser/safe_browsing/browser_feature_extractor.cc |
| diff --git a/chrome/browser/safe_browsing/browser_feature_extractor.cc b/chrome/browser/safe_browsing/browser_feature_extractor.cc |
| index 8d0bd73577bf5b4cf6d8b1f6e26d56e607fae5fa..87415ac45768fdc70f3318e8ee697aba6ff11b71 100644 |
| --- a/chrome/browser/safe_browsing/browser_feature_extractor.cc |
| +++ b/chrome/browser/safe_browsing/browser_feature_extractor.cc |
| @@ -323,30 +323,26 @@ void BrowserFeatureExtractor::StartExtractFeatures( |
| callback.Run(false, request); |
| return; |
| } |
| - CancelableRequestProvider::Handle handle = history->QueryURL( |
| - GURL(request->url()), |
| - true /* wants_visits */, |
| - &request_consumer_, |
| - base::Bind(&BrowserFeatureExtractor::QueryUrlHistoryDone, |
| - base::Unretained(this))); |
| - |
| - StorePendingQuery(handle, request, callback); |
| + scoped_ptr<ClientPhishingRequest> owned_request(request); |
|
blundell
2014/06/12 09:21:18
If you don't do what I suggest above, yes, it woul
sdefresne
2014/06/12 11:18:01
Done.
|
| + history->QueryURL(GURL(request->url()), |
| + true /* wants_visits */, |
| + base::Bind(&BrowserFeatureExtractor::QueryUrlHistoryDone, |
| + base::Unretained(this), |
| + base::Passed(&owned_request), |
| + callback), |
| + &cancelable_task_tracker_); |
| } |
| void BrowserFeatureExtractor::QueryUrlHistoryDone( |
| - CancelableRequestProvider::Handle handle, |
| + scoped_ptr<ClientPhishingRequest> owned_request, |
| + const DoneCallback& callback, |
| bool success, |
| - const history::URLRow* row, |
| - history::VisitVector* visits) { |
| + const history::URLRow& row, |
| + const history::VisitVector& visits) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| - ClientPhishingRequest* request; |
| - DoneCallback callback; |
| - if (!GetPendingQuery(handle, &request, &callback)) { |
| - DLOG(FATAL) << "No pending history query found"; |
| - return; |
| - } |
| - DCHECK(request); |
| + DCHECK(owned_request); |
| DCHECK(!callback.is_null()); |
| + ClientPhishingRequest* request = owned_request.release(); |
| if (!success) { |
| // URL is not found in the history. In practice this should not |
| // happen (unless there is a real error) because we just visited |
| @@ -355,15 +351,16 @@ void BrowserFeatureExtractor::QueryUrlHistoryDone( |
| return; |
| } |
| AddFeature(features::kUrlHistoryVisitCount, |
| - static_cast<double>(row->visit_count()), |
| + static_cast<double>(row.visit_count()), |
| request); |
| base::Time threshold = base::Time::Now() - base::TimeDelta::FromDays(1); |
| int num_visits_24h_ago = 0; |
| int num_visits_typed = 0; |
| int num_visits_link = 0; |
| - for (history::VisitVector::const_iterator it = visits->begin(); |
| - it != visits->end(); ++it) { |
| + for (history::VisitVector::const_iterator it = visits.begin(); |
| + it != visits.end(); |
| + ++it) { |
| if (!content::PageTransitionIsMainFrame(it->transition)) { |
| continue; |
| } |