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

Unified Diff: components/password_manager/core/browser/affiliation_fetch_throttler.h

Issue 1008373003: Integrate throttling logic into AffiliationBackend. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comment. Created 5 years, 9 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: components/password_manager/core/browser/affiliation_fetch_throttler.h
diff --git a/components/password_manager/core/browser/affiliation_fetch_throttler.h b/components/password_manager/core/browser/affiliation_fetch_throttler.h
index f4b75444aa9b24c9b125ea6ea402c67ea41e2d1b..fedce6aea57611426ed0e23e50ab2a833fb16fe2 100644
--- a/components/password_manager/core/browser/affiliation_fetch_throttler.h
+++ b/components/password_manager/core/browser/affiliation_fetch_throttler.h
@@ -51,11 +51,11 @@ class AffiliationFetchThrottler
public:
// Creates an instance that will use |tick_clock| as its tick source, and will
// post to |task_runner| to call the |delegate|'s OnSendNetworkRequest(). The
- // |delegate| should outlive the throttler.
+ // |delegate| and |tick_clock| should outlive the throttler.
AffiliationFetchThrottler(
AffiliationFetchThrottlerDelegate* delegate,
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
- scoped_ptr<base::TickClock> tick_clock);
+ base::TickClock* tick_clock);
~AffiliationFetchThrottler() override;
// Signals to the throttling logic that a network request is needed, and that
@@ -66,11 +66,14 @@ class AffiliationFetchThrottler
// needed or while a request is in flight. To signal that another request will
// be needed right away after the current one, call this method after calling
// InformOfNetworkRequestComplete().
- void SignalNetworkRequestNeeded();
+ virtual void SignalNetworkRequestNeeded();
// Informs the back-off logic that the in-flight network request has been
// completed, either with |success| or not.
- void InformOfNetworkRequestComplete(bool success);
+ virtual void InformOfNetworkRequestComplete(bool success);
+
+ protected:
+ AffiliationFetchThrottlerDelegate* delegate_;
private:
FRIEND_TEST_ALL_PREFIXES(AffiliationFetchThrottlerTest, FailedRequests);
@@ -112,12 +115,11 @@ class AffiliationFetchThrottler
void OnConnectionTypeChanged(
net::NetworkChangeNotifier::ConnectionType type) override;
- AffiliationFetchThrottlerDelegate* delegate_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ base::TickClock* tick_clock_;
State state_;
bool has_network_connectivity_;
bool is_fetch_scheduled_;
- scoped_ptr<base::TickClock> tick_clock_;
scoped_ptr<net::BackoffEntry> exponential_backoff_;
base::WeakPtrFactory<AffiliationFetchThrottler> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698