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

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

Issue 2686203002: [Offline pages] Creating BackgroundJobScheduler, which uses JobScheduler (Closed)
Patch Set: Updating the OS version for BackgroundScheduler#getInstance Created 3 years, 10 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/BackgroundSchedulerJobService.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerJobService.java b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerJobService.java
new file mode 100644
index 0000000000000000000000000000000000000000..b984f4c7d28a54f27ff0ef5c225244aa65351bf4
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerJobService.java
@@ -0,0 +1,35 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.offlinepages;
+
+import android.annotation.TargetApi;
+import android.app.job.JobParameters;
+import android.app.job.JobService;
+import android.os.Build;
+
+/**
+ * The background scheduler job service for handling background request in 5.1+.
+ */
+@TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1)
+public class BackgroundSchedulerJobService extends JobService {
+ @Override
+ public boolean onStartJob(JobParameters params) {
+ // TODO(fgorski): Implement and expose in metadata.
+ // Perhaps initialize application context.
+ // Perhaps ensure one job runs at a time only.
+ // Kick off background processing of downloads here.
+ // Processing will happen on a separate thread, and we'll inform OS when done.
+ return true;
+ }
+
+ @Override
+ public boolean onStopJob(JobParameters params) {
+ // TODO(fgorski): Implement and expose in metadata.
+ // Issue a cancel signal to request coordinator.
+ // This is where synchronization might be necessary.
+ // If we didn't stop ourselves, that likely means there is more work to do.
+ return true;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698