Chromium Code Reviews| Index: chrome/browser/safe_browsing/protocol_manager.h |
| diff --git a/chrome/browser/safe_browsing/protocol_manager.h b/chrome/browser/safe_browsing/protocol_manager.h |
| index fe354284b81f6e4f91571023dcbbb046a537457c..579f26b241703e6c062ab4aea71b1523fc99fd2e 100644 |
| --- a/chrome/browser/safe_browsing/protocol_manager.h |
| +++ b/chrome/browser/safe_browsing/protocol_manager.h |
| @@ -216,6 +216,8 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate, |
| TestParseV4HashResponseNonPermissionMetadata); |
| FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest, |
| TestGetHashBackOffTimes); |
| + FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest, |
| + TestGetV4HashBackOffTimes); |
| FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest, TestNextChunkUrl); |
| FRIEND_TEST_ALL_PREFIXES(SafeBrowsingProtocolManagerTest, TestUpdateUrl); |
| friend class SafeBrowsingServerTest; |
| @@ -284,6 +286,12 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate, |
| base::TimeDelta GetNextBackOffInterval(size_t* error_count, |
| size_t* multiplier) const; |
| + // Worker function for calculating the V4 GetHash backoff times. |
| + // |multiplier| is doubled for each consecutive error after the |
| + // first, and |error_count| is incremented with each call. |
| + static base::TimeDelta GetNextV4BackOffInterval(size_t* error_count, |
| + size_t* multiplier); |
| + |
| // Manages our update with the next allowable update time. If 'back_off_' is |
| // true, we must decrease the frequency of requests of the SafeBrowsing |
| // service according to section 5 of the protocol specification. |
| @@ -318,6 +326,10 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate, |
| // current time is |now|. |
| void HandleGetHashError(const base::Time& now); |
| + // Updates internal state for each GetHash V4 response error, assuming that |
| + // the current time is |now|. |
| + void HandleGetHashV4Error(const base::Time& now); |
| + |
| // Helper function for update completion. |
| void UpdateFinished(bool success); |
| void UpdateFinished(bool success, bool back_off); |
| @@ -359,10 +371,12 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate, |
| // The number of HTTP response errors, used for request backoff timing. |
|
Nathan Parker
2016/01/12 04:14:38
number of HTTP response error since the last succe
kcarattini
2016/01/12 05:18:06
Done.
|
| size_t update_error_count_; |
| size_t gethash_error_count_; |
| + size_t gethash_v4_error_count_; |
| // Multipliers which double (max == 8) for each error after the second. |
| size_t update_back_off_mult_; |
| size_t gethash_back_off_mult_; |
| + size_t gethash_v4_back_off_mult_; |
| // Multiplier between 0 and 1 to spread clients over an interval. |
| float back_off_fuzz_; |
| @@ -394,6 +408,7 @@ class SafeBrowsingProtocolManager : public net::URLFetcherDelegate, |
| // While in GetHash backoff, we can't make another GetHash until this time. |
| base::Time next_gethash_time_; |
| + base::Time next_gethash_v4_time_; |
|
Nathan Parker
2016/01/12 04:14:38
Is this the max of the prescribed min-wait-time an
kcarattini
2016/01/12 05:18:06
No, it should be one or the other. Added a comment
|
| // Current product version sent in each request. |
| std::string version_; |