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

Unified Diff: chrome/browser/safe_browsing/browser_feature_extractor.h

Issue 351553004: Port HistoryService::GetVisibleVisitCountToHost to CancelableTaskTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Linux ASAN tests 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
« no previous file with comments | « chrome/browser/history/history_types.h ('k') | chrome/browser/safe_browsing/browser_feature_extractor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/browser_feature_extractor.h
diff --git a/chrome/browser/safe_browsing/browser_feature_extractor.h b/chrome/browser/safe_browsing/browser_feature_extractor.h
index bae6a16a8a40652646e070716796eaf4bf89667a..28550422873a498eff2837c959b8e3ac18066327 100644
--- a/chrome/browser/safe_browsing/browser_feature_extractor.h
+++ b/chrome/browser/safe_browsing/browser_feature_extractor.h
@@ -20,10 +20,8 @@
#include "base/callback.h"
#include "base/containers/hash_tables.h"
#include "base/memory/scoped_ptr.h"
-#include "base/sequenced_task_runner_helpers.h"
#include "base/task/cancelable_task_tracker.h"
#include "base/time/time.h"
-#include "chrome/browser/common/cancelable_request.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/safe_browsing/ui_manager.h"
@@ -97,7 +95,8 @@ class BrowserFeatureExtractor {
// true iff feature extraction succeeded. The second argument is the
// phishing request which was modified by the feature extractor. The
// DoneCallback takes ownership of the request object.
- typedef base::Callback<void(bool, ClientPhishingRequest*)> DoneCallback;
+ typedef base::Callback<void(bool, scoped_ptr<ClientPhishingRequest>)>
+ DoneCallback;
typedef base::Callback<void(bool, scoped_ptr<ClientMalwareRequest>)>
MalwareDoneCallback;
@@ -130,17 +129,12 @@ class BrowserFeatureExtractor {
const MalwareDoneCallback& callback);
private:
- friend class base::DeleteHelper<BrowserFeatureExtractor>;
- typedef std::pair<ClientPhishingRequest*, DoneCallback> ExtractionData;
- typedef std::map<CancelableRequestProvider::Handle,
- ExtractionData> PendingQueriesMap;
-
// Synchronous browser feature extraction.
void ExtractBrowseInfoFeatures(const BrowseInfo& info,
ClientPhishingRequest* request);
// Actually starts feature extraction (does the real work).
- void StartExtractFeatures(ClientPhishingRequest* request,
+ void StartExtractFeatures(scoped_ptr<ClientPhishingRequest> request,
const DoneCallback& callback);
// HistoryService callback which is called when we're done querying URL visits
@@ -153,14 +147,16 @@ class BrowserFeatureExtractor {
// HistoryService callback which is called when we're done querying HTTP host
// visits in the history.
- void QueryHttpHostVisitsDone(CancelableRequestProvider::Handle handle,
+ void QueryHttpHostVisitsDone(scoped_ptr<ClientPhishingRequest> request,
+ const DoneCallback& callback,
bool success,
int num_visits,
base::Time first_visit);
// HistoryService callback which is called when we're done querying HTTPS host
// visits in the history.
- void QueryHttpsHostVisitsDone(CancelableRequestProvider::Handle handle,
+ void QueryHttpsHostVisitsDone(scoped_ptr<ClientPhishingRequest> request,
+ const DoneCallback& callback,
bool success,
int num_visits,
base::Time first_visit);
@@ -174,19 +170,6 @@ class BrowserFeatureExtractor {
bool is_http_query,
ClientPhishingRequest* request);
- // Helper function which stores the request and callback while the history
- // query is being processed.
- void StorePendingQuery(CancelableRequestProvider::Handle handle,
- ClientPhishingRequest* request,
- const DoneCallback& callback);
-
- // Helper function which is the counterpart of StorePendingQuery. If there
- // is a pending query for the given handle it will return false and set both
- // the request and cb pointers. Otherwise, it will return false.
- bool GetPendingQuery(CancelableRequestProvider::Handle handle,
- ClientPhishingRequest** request,
- DoneCallback* callback);
-
// Helper function which gets the history server if possible. If the pointer
// is set it will return true and false otherwise.
bool GetHistoryService(HistoryService** history);
@@ -199,18 +182,9 @@ class BrowserFeatureExtractor {
content::WebContents* tab_;
ClientSideDetectionHost* host_;
- CancelableRequestConsumer request_consumer_;
base::CancelableTaskTracker cancelable_task_tracker_;
base::WeakPtrFactory<BrowserFeatureExtractor> weak_factory_;
- // Set of pending extractions (i.e. extractions for which ExtractFeatures was
- // called but not StartExtractFeatures).
- std::map<ClientPhishingRequest*, DoneCallback> pending_extractions_;
-
- // Set of pending queries (i.e., where history->Query...() was called but
- // the history callback hasn't been invoked yet).
- PendingQueriesMap pending_queries_;
-
DISALLOW_COPY_AND_ASSIGN(BrowserFeatureExtractor);
};
« no previous file with comments | « chrome/browser/history/history_types.h ('k') | chrome/browser/safe_browsing/browser_feature_extractor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698