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

Unified Diff: components/safe_browsing_db/v4_update_protocol_manager.h

Issue 2470923003: Handle timeout for update requests. (Closed)
Patch Set: rebase 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
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_update_protocol_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 318c47693757b864fcc4ea4a97b259ab687f9259..a3b4cd538e04f24944cbbd34fa9581c05cffc1f2 100644
--- a/components/safe_browsing_db/v4_update_protocol_manager.h
+++ b/components/safe_browsing_db/v4_update_protocol_manager.h
@@ -88,6 +88,8 @@ class V4UpdateProtocolManager : public net::URLFetcherDelegate,
FRIEND_TEST_ALL_PREFIXES(V4UpdateProtocolManagerTest,
TestBase64EncodingUsesUrlEncoding);
FRIEND_TEST_ALL_PREFIXES(V4UpdateProtocolManagerTest, TestDisableAutoUpdates);
+ FRIEND_TEST_ALL_PREFIXES(V4UpdateProtocolManagerTest,
+ TestGetUpdatesHasTimeout);
friend class V4UpdateProtocolManagerFactoryImpl;
// Fills a FetchThreatListUpdatesRequest protocol buffer for a request.
@@ -112,6 +114,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);
@@ -173,6 +179,10 @@ class V4UpdateProtocolManager : public net::URLFetcherDelegate,
base::Time last_response_time_;
+ // Used to interrupt and re-schedule update requests that take too long to
+ // complete.
+ base::OneShotTimer timeout_timer_;
+
DISALLOW_COPY_AND_ASSIGN(V4UpdateProtocolManager);
};
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_update_protocol_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698