[Offline Prefetch] Create a new JobScheduler task to wake up for net activity.
This includes:
* Only waking up on unmetered networks
* Responding to JobScheduler events such as stopping job
* Calling back to Android when the job is finished
* An integration with chrome://offline-internals.
BUG=713243
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
Review-Url: https://codereview.chromium.org/2820263002
Cr-Commit-Position: refs/heads/master@{#469139}
Committed: https://chromium.googlesource.com/chromium/src/+/4b3550fa52e020ed2aebb55f4a5220f4005435a3
3 years, 8 months ago
(2017-04-18 03:07:49 UTC)
#4
Dry run: This issue passed the CQ dry run.
dewittj
Description was changed from ========== Hook up prefetch service to a new JobScheduler task for ...
3 years, 8 months ago
(2017-04-18 23:00:02 UTC)
#5
Description was changed from
==========
Hook up prefetch service to a new JobScheduler task for use as NWake.
BUG=
==========
to
==========
Hook up prefetch service to a new JobScheduler task for use as NWake.
BUG=
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
==========
dewittj
The CQ bit was checked by dewittj@chromium.org to run a CQ dry run
3 years, 8 months ago
(2017-04-18 23:00:44 UTC)
#6
Description was changed from ========== Hook up prefetch service to a new JobScheduler task for ...
3 years, 8 months ago
(2017-04-18 23:02:14 UTC)
#8
Description was changed from
==========
Hook up prefetch service to a new JobScheduler task for use as NWake.
BUG=
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
==========
to
==========
Hook up prefetch service to a new JobScheduler task for use as NWake.
BUG=
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
==========
+carlosk for an early look. I am having trouble unit testing this change, any ideas ...
3 years, 8 months ago
(2017-04-18 23:02:55 UTC)
#10
+carlosk for an early look.
I am having trouble unit testing this change, any ideas would be appreciated.
Also would like to know if this approach seems sane.
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
3 years, 8 months ago
(2017-04-19 00:15:08 UTC)
#11
3 years, 8 months ago
(2017-04-19 00:15:09 UTC)
#12
Dry run: This issue passed the CQ dry run.
dewittj
Description was changed from ========== Hook up prefetch service to a new JobScheduler task for ...
3 years, 8 months ago
(2017-04-19 17:18:24 UTC)
#13
Description was changed from
==========
Hook up prefetch service to a new JobScheduler task for use as NWake.
BUG=
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
==========
to
==========
Hook up prefetch service to a new JobScheduler task for use as NWake.
BUG=713243
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
==========
dewittj
Description was changed from ========== Hook up prefetch service to a new JobScheduler task for ...
3 years, 8 months ago
(2017-04-19 17:19:51 UTC)
#14
Description was changed from
==========
Hook up prefetch service to a new JobScheduler task for use as NWake.
BUG=713243
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
==========
to
==========
[Offline Prefetch] Create a new JobScheduler task to wake up for net activity.
This includes:
* Only waking up on unmetered networks
* Responding to JobScheduler events such as stopping job
* Calling back to Android when the job is finished
* An integration with chrome://offline-internals.
BUG=713243
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
==========
3 years, 8 months ago
(2017-04-20 21:40:09 UTC)
#22
Patchset #6 (id:100001) has been deleted
dewittj
+CC Jian Carlos: I addressed your comments. Some tests should be forthcoming assuming nobody has ...
3 years, 8 months ago
(2017-04-20 21:41:45 UTC)
#23
+CC Jian
Carlos: I addressed your comments.
Some tests should be forthcoming assuming nobody has structural issues with this
patch.
https://codereview.chromium.org/2820263002/diff/80001/chrome/android/java/src...
File
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java
(right):
https://codereview.chromium.org/2820263002/diff/80001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java:47:
* TODO(dewittj): Handle skipping work if the battery percentage is too low.
On 2017/04/19 23:01:38, carlosk wrote:
> It is unfortunate that battery level is not an Android supported
restriction...
Acknowledged.
https://codereview.chromium.org/2820263002/diff/80001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java:59:
// TODO(dewittj): Remove the maximum time to wait.
On 2017/04/19 23:01:37, carlosk wrote:
> Why this TODO? Do you intend to change the API so that this parameter is not
> required? Why not simply set the value to an absurdly long time (like one
year)?
I tried a REALLY absurdly long time, Long.MAX_VALUE, and that had the effect of
scheduling the task immediately :/
Filip recommended that maybe we actually want a periodic task. For now 7 days
should be longer than any expiration time in the DB, so it's probably fine.
https://codereview.chromium.org/2820263002/diff/80001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java:81:
* Loads the antive library and then calls into the PrefetchService, which then
manages the
On 2017/04/19 23:01:38, carlosk wrote:
> s/antive/native/
Done.
https://codereview.chromium.org/2820263002/diff/80001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java:100:
assert mNativeTask != 0;
On 2017/04/19 23:01:38, carlosk wrote:
> Duplicate here the taskId assert from onStartTask.
Done.
https://codereview.chromium.org/2820263002/diff/80001/chrome/browser/android/...
File chrome/browser/android/offline_pages/prefetch/prefetch_background_task.h
(right):
https://codereview.chromium.org/2820263002/diff/80001/chrome/browser/android/...
chrome/browser/android/offline_pages/prefetch/prefetch_background_task.h:16:
class PrefetchBackgroundTask : public PrefetchService::ScopedBackgroundTask {
On 2017/04/19 23:01:38, carlosk wrote:
> Why is this out of the offline_pages::prefetch namespace?
I invented the offline_pages::prefetch namespace only for the JNI generator,
since it makes a static function with a predictable name and the offline_pages::
namespace already had such a function. I don't intend for all this code to go
into the sub namespace.
https://codereview.chromium.org/2820263002/diff/80001/components/offline_page...
File components/offline_pages/core/prefetch/prefetch_service.cc (right):
https://codereview.chromium.org/2820263002/diff/80001/components/offline_page...
components/offline_pages/core/prefetch/prefetch_service.cc:10:
PrefetchService::ScopedBackgroundTask::~ScopedBackgroundTask() = default;
On 2017/04/19 23:01:38, carlosk wrote:
> Was it impossible to define these in the .h?
Yes, lint checks barfed on that
dewittj
Thanks for waiting! I added a junit test. -fgorski (out) +dimich
3 years, 7 months ago
(2017-05-01 16:41:50 UTC)
#24
Thanks for waiting! I added a junit test.
-fgorski (out)
+dimich
dewittj
The CQ bit was checked by dewittj@chromium.org to run a CQ dry run
3 years, 7 months ago
(2017-05-01 16:42:35 UTC)
#25
LGTM with a couple minor comments. General CR comment: whenever possible upload rebases in isolation ...
3 years, 7 months ago
(2017-05-01 17:26:29 UTC)
#30
LGTM with a couple minor comments.
General CR comment: whenever possible upload rebases in isolation from your own
changes. It makes comparing changes between patch sets much easier for
reviewers.
https://codereview.chromium.org/2820263002/diff/80001/chrome/android/java/src...
File
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java
(right):
https://codereview.chromium.org/2820263002/diff/80001/chrome/android/java/src...
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java:59:
// TODO(dewittj): Remove the maximum time to wait.
On 2017/04/20 21:41:45, dewittj wrote:
> On 2017/04/19 23:01:37, carlosk wrote:
> > Why this TODO? Do you intend to change the API so that this parameter is not
> > required? Why not simply set the value to an absurdly long time (like one
> year)?
>
> I tried a REALLY absurdly long time, Long.MAX_VALUE, and that had the effect
of
> scheduling the task immediately :/
>
> Filip recommended that maybe we actually want a periodic task. For now 7 days
> should be longer than any expiration time in the DB, so it's probably fine.
I think it is still important to not do work -- especially network access --
when not connected to "free" wifi, even if this is triggered after a week. We
don't need to solve this in this patch but we should updateconfirm we are in the
required conditions to do the heavy lifting.
https://codereview.chromium.org/2820263002/diff/140001/components/offline_pag...
File components/offline_pages/core/prefetch/prefetch_service_impl.cc (right):
https://codereview.chromium.org/2820263002/diff/140001/components/offline_pag...
components/offline_pages/core/prefetch/prefetch_service_impl.cc:27:
std::unique_ptr<ScopedBackgroundTask> task) {}
nit: Use NOTIMPLEMENTED as in previous cases here and below.
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
3 years, 7 months ago
(2017-05-01 18:14:43 UTC)
#31
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/442692)
3 years, 7 months ago
(2017-05-01 18:14:44 UTC)
#32
https://codereview.chromium.org/2820263002/diff/160001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java File chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java (right): https://codereview.chromium.org/2820263002/diff/160001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java#newcode69 chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java:69: // TODO(dewittj): Remove the maximum time to wait. If ...
3 years, 7 months ago
(2017-05-01 18:14:56 UTC)
#33
3 years, 7 months ago
(2017-05-01 22:16:35 UTC)
#36
thanks, ptal
https://codereview.chromium.org/2820263002/diff/140001/components/offline_pag...
File components/offline_pages/core/prefetch/prefetch_service_impl.cc (right):
https://codereview.chromium.org/2820263002/diff/140001/components/offline_pag...
components/offline_pages/core/prefetch/prefetch_service_impl.cc:27:
std::unique_ptr<ScopedBackgroundTask> task) {}
On 2017/05/01 17:26:29, carlosk wrote:
> nit: Use NOTIMPLEMENTED as in previous cases here and below.
Done.
https://codereview.chromium.org/2820263002/diff/160001/chrome/android/java/sr...
File
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java
(right):
https://codereview.chromium.org/2820263002/diff/160001/chrome/android/java/sr...
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java:69:
// TODO(dewittj): Remove the maximum time to wait.
On 2017/05/01 18:14:56, Dmitry Titov wrote:
> If this is a reasonable upper limit, then why have a TODO?
Done.
https://codereview.chromium.org/2820263002/diff/160001/chrome/android/java/sr...
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java:110:
assert mNativeTask != 0;
On 2017/05/01 18:14:56, Dmitry Titov wrote:
> lets replace assert with 'if' here, above as well.
What should we return here? the return value is whether the system should
reschedule us. If we are in a race condition the we should already have told
the system as in |doneProcessing|. Same question above, not sure what we should
do with the return values.
https://codereview.chromium.org/2820263002/diff/160001/chrome/android/java/sr...
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java:145:
// TODO(fgorski): This method is taken from ChromeBackgroundService as a local
fix and will
On 2017/05/01 18:14:56, Dmitry Titov wrote:
> as a local fix for what exactly?
The BackgroundTaskScheduler will eventually be able to load the native library,
but does not yet.
> Also, is BackgroundTaskScheduler incomplete?
Yes, GCMNetworkManager integration is incomplete (along with loading native)
> Could you add a bug number here to track?
Done.
https://codereview.chromium.org/2820263002/diff/160001/chrome/browser/android...
File chrome/browser/android/offline_pages/prefetch/prefetch_background_task.h
(right):
https://codereview.chromium.org/2820263002/diff/160001/chrome/browser/android...
chrome/browser/android/offline_pages/prefetch/prefetch_background_task.h:25: //
Schedules the default 'NWake' prefetching task. Does nothing if
On 2017/05/01 18:14:56, Dmitry Titov wrote:
> Not clear about JobScheduler not being supported... This seems to work through
> scheduler that is always present in some form, right?
You are right, those comments were outdated.
3 years, 7 months ago
(2017-05-01 23:07:43 UTC)
#37
https://codereview.chromium.org/2820263002/diff/160001/chrome/android/java/sr...
File
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java
(right):
https://codereview.chromium.org/2820263002/diff/160001/chrome/android/java/sr...
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java:110:
assert mNativeTask != 0;
On 2017/05/01 22:16:34, dewittj wrote:
> On 2017/05/01 18:14:56, Dmitry Titov wrote:
> > lets replace assert with 'if' here, above as well.
>
> What should we return here? the return value is whether the system should
> reschedule us. If we are in a race condition the we should already have told
> the system as in |doneProcessing|. Same question above, not sure what we
should
> do with the return values.
onStartTask we should return false which means "remove wakelock, task was not
really started"
onStopTask we should return false because something is going awry apparently.
For this specific bool return, we might always return false and instead
reschedule very early in onStartTask :) if this is possible.
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
3 years, 7 months ago
(2017-05-01 23:50:00 UTC)
#38
Dry run: Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/443023)
3 years, 7 months ago
(2017-05-01 23:50:00 UTC)
#39
3 years, 7 months ago
(2017-05-02 22:42:22 UTC)
#45
https://codereview.chromium.org/2820263002/diff/160001/chrome/android/java/sr...
File
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java
(right):
https://codereview.chromium.org/2820263002/diff/160001/chrome/android/java/sr...
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java:110:
assert mNativeTask != 0;
On 2017/05/01 23:07:43, Dmitry Titov wrote:
> On 2017/05/01 22:16:34, dewittj wrote:
> > On 2017/05/01 18:14:56, Dmitry Titov wrote:
> > > lets replace assert with 'if' here, above as well.
> >
> > What should we return here? the return value is whether the system should
> > reschedule us. If we are in a race condition the we should already have
told
> > the system as in |doneProcessing|. Same question above, not sure what we
> should
> > do with the return values.
>
> onStartTask we should return false which means "remove wakelock, task was not
> really started"
> onStopTask we should return false because something is going awry apparently.
> For this specific bool return, we might always return false and instead
> reschedule very early in onStartTask :) if this is possible.
Done.
3 years, 7 months ago
(2017-05-02 23:12:25 UTC)
#47
+dtrainor for chrome/android/junit/DEPS
Thanks!
Dmitry Titov
lgtm with a nit: https://codereview.chromium.org/2820263002/diff/220001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java File chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java (right): https://codereview.chromium.org/2820263002/diff/220001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java#newcode63 chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java:63: TaskInfo.createOneOffTask(TaskIds.OFFLINE_PAGES_PREFETCH_JOB_ID, This is where we ...
3 years, 7 months ago
(2017-05-02 23:51:42 UTC)
#48
+tommycli for webui, offline_internals https://codereview.chromium.org/2820263002/diff/220001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java File chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java (right): https://codereview.chromium.org/2820263002/diff/220001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java#newcode63 chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java:63: TaskInfo.createOneOffTask(TaskIds.OFFLINE_PAGES_PREFETCH_JOB_ID, On 2017/05/02 23:51:42, Dmitry ...
3 years, 7 months ago
(2017-05-03 15:45:40 UTC)
#53
+tommycli for webui, offline_internals
https://codereview.chromium.org/2820263002/diff/220001/chrome/android/java/sr...
File
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java
(right):
https://codereview.chromium.org/2820263002/diff/220001/chrome/android/java/sr...
chrome/android/java/src/org/chromium/chrome/browser/offlinepages/prefetch/PrefetchBackgroundTask.java:63:
TaskInfo.createOneOffTask(TaskIds.OFFLINE_PAGES_PREFETCH_JOB_ID,
On 2017/05/02 23:51:42, Dmitry Titov wrote:
> This is where we would change it to be a repeating task, correct? Do you plan
to
> change it in a later CL?
Yes, in another patch.
tommycli
lgtm with some nits https://codereview.chromium.org/2820263002/diff/220001/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc File chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc (right): https://codereview.chromium.org/2820263002/diff/220001/chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc#newcode231 chrome/browser/ui/webui/offline/offline_internals_ui_message_handler.cc:231: void OfflineInternalsUIMessageHandler::HandleScheduleNwake( Can these methods ...
3 years, 7 months ago
(2017-05-03 16:00:13 UTC)
#54
The patchset sent to the CQ was uploaded after l-g-t-m from carlosk@chromium.org, tommycli@chromium.org, dtrainor@chromium.org, dimich@chromium.org ...
3 years, 7 months ago
(2017-05-03 21:34:15 UTC)
#61
CQ is committing da patch. Bot data: {"patchset_id": 240001, "attempt_start_ts": 1493847255481280, "parent_rev": "847ddc166e042a5e929ac16c9327dc3e02cba21c", "commit_rev": "4b3550fa52e020ed2aebb55f4a5220f4005435a3"}
3 years, 7 months ago
(2017-05-03 21:44:42 UTC)
#63
CQ is committing da patch.
Bot data: {"patchset_id": 240001, "attempt_start_ts": 1493847255481280,
"parent_rev": "847ddc166e042a5e929ac16c9327dc3e02cba21c", "commit_rev":
"4b3550fa52e020ed2aebb55f4a5220f4005435a3"}
commit-bot: I haz the power
Description was changed from ========== [Offline Prefetch] Create a new JobScheduler task to wake up ...
3 years, 7 months ago
(2017-05-03 21:44:50 UTC)
#64
Message was sent while issue was closed.
Description was changed from
==========
[Offline Prefetch] Create a new JobScheduler task to wake up for net activity.
This includes:
* Only waking up on unmetered networks
* Responding to JobScheduler events such as stopping job
* Calling back to Android when the job is finished
* An integration with chrome://offline-internals.
BUG=713243
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
==========
to
==========
[Offline Prefetch] Create a new JobScheduler task to wake up for net activity.
This includes:
* Only waking up on unmetered networks
* Responding to JobScheduler events such as stopping job
* Calling back to Android when the job is finished
* An integration with chrome://offline-internals.
BUG=713243
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
Review-Url: https://codereview.chromium.org/2820263002
Cr-Commit-Position: refs/heads/master@{#469139}
Committed:
https://chromium.googlesource.com/chromium/src/+/4b3550fa52e020ed2aebb55f4a52...
==========
commit-bot: I haz the power
Committed patchset #12 (id:240001) as https://chromium.googlesource.com/chromium/src/+/4b3550fa52e020ed2aebb55f4a5220f4005435a3
3 years, 7 months ago
(2017-05-03 21:44:51 UTC)
#65
Issue 2820263002: [Offline Prefetch] Create a new JobScheduler task to wake up for net activity.
(Closed)
Created 3 years, 8 months ago by dewittj
Modified 3 years, 7 months ago
Reviewers: carlosk, Dmitry Titov, David Trainor- moved to gerrit, tommycli
Base URL:
Comments: 34