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

Unified Diff: components/safe_browsing_db/v4_update_protocol_manager.h

Issue 2470923003: Handle timeout for update requests. (Closed)
Patch Set: Added a histogram for counting update timeouts 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 318c47693757b864fcc4ea4a97b259ab687f9259..d7655f2aa65de5ad04714973f01281cbaee44a19 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,9 @@ class V4UpdateProtocolManager : public net::URLFetcherDelegate,
base::Time last_response_time_;
+ // Used to interrupt and re-issue update requests that take too long.
Nathan Parker 2016/11/08 23:39:29 It doesn't re-issue, it just reschedules now, yes?
vakh (use Gerrit instead) 2016/11/09 00:08:51 Done.
+ base::OneShotTimer timeout_timer_;
+
DISALLOW_COPY_AND_ASSIGN(V4UpdateProtocolManager);
};

Powered by Google App Engine
This is Rietveld 408576698