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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerProcessor.java

Issue 2830843002: [Offline pages] Updates to background scheduling to use BTS (Closed)
Patch Set: Fixing the crash on NCN not being initialized Created 3 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.offlinepages;
6
7 import org.chromium.base.Callback;
8 import org.chromium.base.VisibleForTesting;
9
10 /** Class allowing for mocking out calls to BackgroundSchedulerBridge. */
11 public class BackgroundSchedulerProcessor {
12 private static BackgroundSchedulerProcessor sInstance;
13
14 /** Returns a singleton instance. */
15 public static BackgroundSchedulerProcessor getInstance() {
16 if (sInstance == null) {
17 sInstance = new BackgroundSchedulerProcessor();
18 }
19 return sInstance;
20 }
21
22 @VisibleForTesting
23 static void setInstanceForTesting(BackgroundSchedulerProcessor instance) {
24 sInstance = instance;
25 }
26
27 /**
28 * Starts processing of one or more queued background requests. Returns whe ther processing was
29 * started and that caller should expect a callback (once processing has com pleted or
30 * terminated). If processing was already active or not able to process for some other reason,
31 * returns false and this calling instance will not receive a callback.
32 */
33 public boolean startScheduledProcessing(
34 DeviceConditions deviceConditions, Callback<Boolean> callback) {
35 return BackgroundSchedulerBridge.startScheduledProcessing(deviceConditio ns, callback);
36 }
37
38 /**
39 * Stops processing background requests.
40 * @return Whether processing should be scheduled again at a later time, bec ause there is more
41 * work.
42 */
43 public boolean stopScheduledProcessing() {
44 return BackgroundSchedulerBridge.stopScheduledProcessing();
45 }
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698