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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java

Issue 2780643002: Fix ChromeBackgroundServiceWaiter timeout, and restart offline pages (Closed)
Patch Set: Fix unit test failure Created 3 years, 9 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
Index: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java
index 66d049335c5a40409c2d976ad789ab2a59afd80c..38f5eeb4207d97f925e5173bfe6e18c0af568290 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java
@@ -14,6 +14,7 @@ import java.util.concurrent.TimeUnit;
*/
public abstract class BackgroundScheduler {
private static final long ONE_WEEK_IN_SECONDS = TimeUnit.DAYS.toSeconds(7);
+ private static final long FIVE_MINUTES_IN_SECONDS = TimeUnit.MINUTES.toSeconds(5);
private static final long NO_DELAY = 0;
private static final boolean OVERWRITE = true;
@@ -72,4 +73,16 @@ public abstract class BackgroundScheduler {
protected Context getContext() {
return mContext;
}
+
+ /**
+ * If GooglePlayServices upgrades, any outstaning tasks will be lost.
+ * Set a reminder to wake up and check the task queue if an upgrade happens.
+ */
+ public void rescheduleOfflinePagesTasksOnUpgrade() {
+ // We use the least restrictive trigger conditions. A wakeup will cause
+ // the queue to be checked, and the trigger conditions will be replaced by
+ // the current trigger conditions needed.
+ TriggerConditions triggerConditions = new TriggerConditions(false, 0, false);
+ scheduleBackup(triggerConditions, FIVE_MINUTES_IN_SECONDS);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698