OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.offlinepages.prefetch; | 5 package org.chromium.chrome.browser.offlinepages.prefetch; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 | 8 |
9 import org.chromium.base.ContextUtils; | 9 import org.chromium.base.ContextUtils; |
10 import org.chromium.base.Log; | 10 import org.chromium.base.Log; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 108 } |
109 | 109 |
110 @Override | 110 @Override |
111 public boolean onStopTask(Context context, TaskParameters taskParameters) { | 111 public boolean onStopTask(Context context, TaskParameters taskParameters) { |
112 assert taskParameters.getTaskId() == TaskIds.OFFLINE_PAGES_PREFETCH_JOB_
ID; | 112 assert taskParameters.getTaskId() == TaskIds.OFFLINE_PAGES_PREFETCH_JOB_
ID; |
113 if (mNativeTask == 0) return false; | 113 if (mNativeTask == 0) return false; |
114 | 114 |
115 return nativeOnStopTask(mNativeTask); | 115 return nativeOnStopTask(mNativeTask); |
116 } | 116 } |
117 | 117 |
| 118 @Override |
| 119 public void reschedule(Context context) {} |
| 120 |
118 /** | 121 /** |
119 * Called during construction of the native task. | 122 * Called during construction of the native task. |
120 * | 123 * |
121 * PrefetchBackgroundTask#onStartTask constructs the native task. | 124 * PrefetchBackgroundTask#onStartTask constructs the native task. |
122 */ | 125 */ |
123 @VisibleForTesting | 126 @VisibleForTesting |
124 @CalledByNative | 127 @CalledByNative |
125 void setNativeTask(long nativeTask) { | 128 void setNativeTask(long nativeTask) { |
126 mNativeTask = nativeTask; | 129 mNativeTask = nativeTask; |
127 } | 130 } |
(...skipping 27 matching lines...) Expand all Loading... |
155 // the whole application not just the activity. | 158 // the whole application not just the activity. |
156 System.exit(-1); | 159 System.exit(-1); |
157 } | 160 } |
158 } | 161 } |
159 | 162 |
160 @VisibleForTesting | 163 @VisibleForTesting |
161 native boolean nativeStartPrefetchTask(Profile profile); | 164 native boolean nativeStartPrefetchTask(Profile profile); |
162 @VisibleForTesting | 165 @VisibleForTesting |
163 native boolean nativeOnStopTask(long nativePrefetchBackgroundTask); | 166 native boolean nativeOnStopTask(long nativePrefetchBackgroundTask); |
164 } | 167 } |
OLD | NEW |