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

Unified Diff: chrome/browser/extensions/updater/extension_updater.cc

Issue 240333010: Limit extension autoupdates timer maximum scheduled delay. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/updater/extension_updater.cc
diff --git a/chrome/browser/extensions/updater/extension_updater.cc b/chrome/browser/extensions/updater/extension_updater.cc
index 45f1ab807d8fcdc3e882513abdbe4377730afd95..4afe45c2fc97acfa1fe3125634f6d3a3cb597b2b 100644
--- a/chrome/browser/extensions/updater/extension_updater.cc
+++ b/chrome/browser/extensions/updater/extension_updater.cc
@@ -193,12 +193,13 @@ TimeDelta ExtensionUpdater::DetermineFirstCheckDelay() {
kStartupWaitSeconds * 8));
}
- // Read the persisted next check time, and use that if it isn't too soon.
- // Otherwise pick something random.
+ // Read the persisted next check time, and use that if it isn't too soon
+ // or too late. Otherwise pick something random.
Time saved_next = Time::FromInternalValue(prefs_->GetInt64(
pref_names::kNextUpdateCheck));
Time earliest = now + TimeDelta::FromSeconds(kStartupWaitSeconds);
- if (saved_next >= earliest) {
+ Time latest = now + TimeDelta::FromSeconds(frequency_seconds_);
+ if (saved_next >= earliest && saved_next <= latest) {
return saved_next - now;
} else {
return TimeDelta::FromSeconds(RandInt(kStartupWaitSeconds,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698