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

Unified Diff: components/safe_browsing_db/v4_update_protocol_manager.h

Issue 2470923003: Handle timeout for update requests. (Closed)
Patch Set: Created 4 years, 1 month 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/safe_browsing_db/v4_update_protocol_manager.h
diff --git a/components/safe_browsing_db/v4_update_protocol_manager.h b/components/safe_browsing_db/v4_update_protocol_manager.h
index 7da1667c66f5012bd8949e5bfe8d1bc25e88323e..14ae93ead1fd0cb2264bd8e9745412edb0f29a30 100644
--- a/components/safe_browsing_db/v4_update_protocol_manager.h
+++ b/components/safe_browsing_db/v4_update_protocol_manager.h
@@ -87,6 +87,8 @@ class V4UpdateProtocolManager : public net::URLFetcherDelegate,
TestGetUpdatesWithOneBackoff);
FRIEND_TEST_ALL_PREFIXES(V4UpdateProtocolManagerTest,
TestBase64EncodingUsesUrlEncoding);
+ FRIEND_TEST_ALL_PREFIXES(V4UpdateProtocolManagerTest,
+ TestGetUpdatesHasTimeout);
friend class V4UpdateProtocolManagerFactoryImpl;
// Fills a FetchThreatListUpdatesRequest protocol buffer for a request.
@@ -111,6 +113,10 @@ class V4UpdateProtocolManager : public net::URLFetcherDelegate,
// Resets the update error counter and multiplier.
void ResetUpdateErrors();
+ // Called when update request times out. Cancels the existing request and
+ // re-sends the update request.
+ void HandleTimeout();
+
// Updates internal update and backoff state for each update response error,
// assuming that the current time is |now|.
void HandleUpdateError(const base::Time& now);
@@ -172,6 +178,9 @@ class V4UpdateProtocolManager : public net::URLFetcherDelegate,
base::Time last_response_time_;
+ // Used to interrupt and re-issue update requests that take too long.
+ base::OneShotTimer timeout_timer_;
+
DISALLOW_COPY_AND_ASSIGN(V4UpdateProtocolManager);
};

Powered by Google App Engine
This is Rietveld 408576698