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

Unified Diff: components/update_client/update_engine.h

Issue 1740333002: Allow fallback from https to http for component update checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « components/update_client/update_client_unittest.cc ('k') | components/update_client/update_engine.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/update_client/update_engine.h
diff --git a/components/update_client/update_engine.h b/components/update_client/update_engine.h
index f2a577a393f4cecef88220d82ac76a0b552fc800..1d69ece4d62ca51363623fb2b29b82e5937b433b 100644
--- a/components/update_client/update_engine.h
+++ b/components/update_client/update_engine.h
@@ -63,6 +63,10 @@ class UpdateEngine {
private:
void UpdateComplete(UpdateContext* update_context, int error);
+ // Returns true if the update engine rejects this update call because it
+ // occurs too soon.
+ bool IsThrottled(bool is_foreground) const;
+
base::ThreadChecker thread_checker_;
scoped_refptr<Configurator> config_;
@@ -79,6 +83,12 @@ class UpdateEngine {
// Contains the contexts associated with each update in progress.
std::set<UpdateContext*> update_contexts_;
+ // Implements a rate limiting mechanism for background update checks. Has the
+ // effect of rejecting the update call if the update call occurs before
+ // a certain time, which is negotiated with the server as part of the
+ // update protocol. See the comments for X-Retry-After header.
+ base::Time throttle_updates_until_;
+
DISALLOW_COPY_AND_ASSIGN(UpdateEngine);
};
@@ -135,6 +145,9 @@ struct UpdateContext {
// Contains the ids of the items to update.
std::queue<std::string> queue;
+
+ // The time in seconds to wait until doing further update checks.
+ int retry_after_sec_;
};
} // namespace update_client
« no previous file with comments | « components/update_client/update_client_unittest.cc ('k') | components/update_client/update_engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698