New issue
Advanced search Search tips

Issue 692621 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

The BackgroundFetch system should use the DownloadManager to initiate download requests.

Project Member Reported by harkness@chromium.org, Feb 15 2017

Issue description

The BackgroundFetch system is a way for a developer to request persistent downloads of batches of one or more files. To reduce the complexity, the system should use the DownloadManager to perform the mechanics of actually downloading individual files.

* Initiated downloads should hand off to the DownloadManager.
* A DownloadObserver should monitor the state of the download.
* On restart, download observers should be re-linked to in progress downloads.
* Downloads initiated to the DownloadManager need to pre-validate the destination URL, since the DownloadManager won't do checks for the non-frame download case.
 
Cc: mlamouri@chromium.org
Project Member

Comment 2 by bugdroid1@chromium.org, Feb 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a247d9bf7b2082393dd172c0d78c33b044d646e2

commit a247d9bf7b2082393dd172c0d78c33b044d646e2
Author: harkness <harkness@chromium.org>
Date: Tue Feb 28 17:01:53 2017

Create the BackgroundFetchBatchManager and initiate a download.

The BatchManager will be the component in the BackgroundFetch service
that takes care of tracking which particular downloads in batch have
completed and which ones are still in progress.

This CL adds the framework for the BatchManager as well as the new
BatchRequest skeleton which collects multiple FetchRequests into a
single batch.

Currently the BatchManager just starts a download, it's not doing any
observation of the download system. That will be in the next CL.

BUG= 692621 , 692544 

Review-Url: https://codereview.chromium.org/2708943002
Cr-Commit-Position: refs/heads/master@{#453627}

[modify] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/browser/BUILD.gn
[modify] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/browser/background_fetch/background_fetch_context.cc
[modify] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/browser/background_fetch/background_fetch_context.h
[modify] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/browser/background_fetch/background_fetch_data_manager.cc
[modify] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/browser/background_fetch/background_fetch_data_manager.h
[modify] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/browser/background_fetch/background_fetch_data_manager_unittest.cc
[add] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/browser/background_fetch/background_fetch_job_controller.cc
[add] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/browser/background_fetch/background_fetch_job_controller.h
[add] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/browser/background_fetch/background_fetch_job_controller_unittest.cc
[add] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/browser/background_fetch/background_fetch_job_data.cc
[add] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/browser/background_fetch/background_fetch_job_data.h
[add] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/browser/background_fetch/background_fetch_job_info.cc
[add] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/browser/background_fetch/background_fetch_job_info.h
[add] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/browser/background_fetch/background_fetch_request_info.cc
[add] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/browser/background_fetch/background_fetch_request_info.h
[delete] https://crrev.com/5945b6a2a3a58705e9fc58a0ca12e157c1ae1f7f/content/browser/background_fetch/fetch_request.cc
[delete] https://crrev.com/5945b6a2a3a58705e9fc58a0ca12e157c1ae1f7f/content/browser/background_fetch/fetch_request.h
[modify] https://crrev.com/a247d9bf7b2082393dd172c0d78c33b044d646e2/content/test/BUILD.gn

Project Member

Comment 3 by bugdroid1@chromium.org, Mar 11 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/dfe1dfe7bc684f54d0242262fd98ecde0afb29e0

commit dfe1dfe7bc684f54d0242262fd98ecde0afb29e0
Author: harkness <harkness@chromium.org>
Date: Sat Mar 11 22:46:55 2017

Added DownloadItem::Observer to JobController.

Previously the JobController would submit requests to the DownloadManager,
but then it would never do anything when the requests completed/failed.
This CL implements DownloadItem::Observer on JobController, which means
that the JobController will be notified of changes to the download.

Implementation of actions taken based on the notifications is still in
progress, but this provides a basic implementation and a framework for
testing the actions going forward.

BUG= 692621 

Review-Url: https://codereview.chromium.org/2727253002
Cr-Commit-Position: refs/heads/master@{#456288}

[modify] https://crrev.com/dfe1dfe7bc684f54d0242262fd98ecde0afb29e0/content/browser/background_fetch/background_fetch_context.cc
[modify] https://crrev.com/dfe1dfe7bc684f54d0242262fd98ecde0afb29e0/content/browser/background_fetch/background_fetch_context.h
[modify] https://crrev.com/dfe1dfe7bc684f54d0242262fd98ecde0afb29e0/content/browser/background_fetch/background_fetch_job_controller.cc
[modify] https://crrev.com/dfe1dfe7bc684f54d0242262fd98ecde0afb29e0/content/browser/background_fetch/background_fetch_job_controller.h
[modify] https://crrev.com/dfe1dfe7bc684f54d0242262fd98ecde0afb29e0/content/browser/background_fetch/background_fetch_job_controller_unittest.cc
[modify] https://crrev.com/dfe1dfe7bc684f54d0242262fd98ecde0afb29e0/content/browser/background_fetch/background_fetch_job_data.cc
[modify] https://crrev.com/dfe1dfe7bc684f54d0242262fd98ecde0afb29e0/content/browser/background_fetch/background_fetch_job_data.h
[modify] https://crrev.com/dfe1dfe7bc684f54d0242262fd98ecde0afb29e0/content/browser/background_fetch/background_fetch_request_info.cc
[modify] https://crrev.com/dfe1dfe7bc684f54d0242262fd98ecde0afb29e0/content/browser/background_fetch/background_fetch_request_info.h

Project Member

Comment 4 by bugdroid1@chromium.org, Mar 13 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/41f3b13b61278aa9aa7660b6acfd22091cdc75e5

commit 41f3b13b61278aa9aa7660b6acfd22091cdc75e5
Author: harkness <harkness@chromium.org>
Date: Mon Mar 13 16:15:07 2017

Moved the FakeDownloadItem to content/public/test.

The new tab page tests implemented a mostly-complete FakeDownloadItem.
content/public/test already contains a mock for a DownloadItem and Fakes
for other classes, and the BackgroundFetch tests will also be needing
a fake DownloadItem, so this CL moves the FakeDownloadItem to the more
accessible location.

BUG= 692621 

Review-Url: https://codereview.chromium.org/2745003003
Cr-Commit-Position: refs/heads/master@{#456394}

[delete] https://crrev.com/2118ab72a4ce9ff79eccdbd769451c4ccc042fb1/chrome/browser/ntp_snippets/BUILD.gn
[modify] https://crrev.com/41f3b13b61278aa9aa7660b6acfd22091cdc75e5/chrome/browser/ntp_snippets/download_suggestions_provider_unittest.cc
[modify] https://crrev.com/41f3b13b61278aa9aa7660b6acfd22091cdc75e5/chrome/test/BUILD.gn
[rename] https://crrev.com/41f3b13b61278aa9aa7660b6acfd22091cdc75e5/content/public/test/fake_download_item.cc
[rename] https://crrev.com/41f3b13b61278aa9aa7660b6acfd22091cdc75e5/content/public/test/fake_download_item.h
[modify] https://crrev.com/41f3b13b61278aa9aa7660b6acfd22091cdc75e5/content/test/BUILD.gn

Project Member

Comment 5 by bugdroid1@chromium.org, Mar 15 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e816138fb520f5fc8a2207212845554226af8226

commit e816138fb520f5fc8a2207212845554226af8226
Author: harkness <harkness@chromium.org>
Date: Wed Mar 15 17:19:24 2017

Add tests for the JobController's observer.

Update the mock DownloadManager to keep track of DownloadItems which
have been created and allow the test to update those items. Also
added tests which explicitly update the DownloadItems and trigger the
DownloadItem::Observer to check that the JobController is doing the right
thing when successful updates happen.

BUG= 692621 

Review-Url: https://codereview.chromium.org/2733823005
Cr-Commit-Position: refs/heads/master@{#457116}

[modify] https://crrev.com/e816138fb520f5fc8a2207212845554226af8226/content/browser/background_fetch/background_fetch_job_controller_unittest.cc

Project Member

Comment 6 by bugdroid1@chromium.org, Mar 19 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b56e7169125edf091bf4f5b6a4e830218653f880

commit b56e7169125edf091bf4f5b6a4e830218653f880
Author: harkness <harkness@chromium.org>
Date: Sun Mar 19 19:01:26 2017

Add the JobComplete callback and error/interrupt information

This adds a way for the JobController to communicate the completion of
a background fetch job. It also expands the state tracking for the
individual download requests so that the system can tell if requests
succeeded or were cancelled.

BUG= 692621 

Review-Url: https://codereview.chromium.org/2753583002
Cr-Commit-Position: refs/heads/master@{#458000}

[modify] https://crrev.com/b56e7169125edf091bf4f5b6a4e830218653f880/content/browser/background_fetch/background_fetch_context.cc
[modify] https://crrev.com/b56e7169125edf091bf4f5b6a4e830218653f880/content/browser/background_fetch/background_fetch_context.h
[modify] https://crrev.com/b56e7169125edf091bf4f5b6a4e830218653f880/content/browser/background_fetch/background_fetch_data_manager_unittest.cc
[modify] https://crrev.com/b56e7169125edf091bf4f5b6a4e830218653f880/content/browser/background_fetch/background_fetch_job_controller.cc
[modify] https://crrev.com/b56e7169125edf091bf4f5b6a4e830218653f880/content/browser/background_fetch/background_fetch_job_controller.h
[modify] https://crrev.com/b56e7169125edf091bf4f5b6a4e830218653f880/content/browser/background_fetch/background_fetch_job_controller_unittest.cc
[modify] https://crrev.com/b56e7169125edf091bf4f5b6a4e830218653f880/content/browser/background_fetch/background_fetch_job_data.cc
[modify] https://crrev.com/b56e7169125edf091bf4f5b6a4e830218653f880/content/browser/background_fetch/background_fetch_job_data.h
[modify] https://crrev.com/b56e7169125edf091bf4f5b6a4e830218653f880/content/browser/background_fetch/background_fetch_request_info.cc
[modify] https://crrev.com/b56e7169125edf091bf4f5b6a4e830218653f880/content/browser/background_fetch/background_fetch_request_info.h
[modify] https://crrev.com/b56e7169125edf091bf4f5b6a4e830218653f880/content/public/test/fake_download_item.cc
[modify] https://crrev.com/b56e7169125edf091bf4f5b6a4e830218653f880/content/public/test/fake_download_item.h

Project Member

Comment 7 by bugdroid1@chromium.org, Mar 27 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4a4b593243e2acdedd593b84db51de418a801663

commit 4a4b593243e2acdedd593b84db51de418a801663
Author: harkness <harkness@chromium.org>
Date: Mon Mar 27 16:15:09 2017

Implement GetJobResponse and merge JobData into DataManager.

This CL has two major changes. The first is the addition of the
GetJobResponse call on the DataManager. This Creates a new (and likely
temporary) BackgroundFetchJobResponseData which is owned by the JobInfo
and exists to collect the information needed to construct the Response
that will eventually be sent to Mojo.

The second major change is merging the JobData back into the DataManager.
The JobData was always intended as a cache layer to assist in fetches
involving large numbers of files in a batch, but given the desire to
reduce the memory footprint of Chrome and the relative rarity of these
operations, the cache layer is being removed in favor of storage accesses.

Minor changes:
* More attempts to isolate the eventual storage interface.
* Methods on the JobData which were moved to the DataManager are now virtual
  for testing.
* DataManager takes a BrowserContext* instead of BackgroundFetchContext*.
* Much of the batch management which was in JobData is now handled in
  BackgroundFetchJobInfo.

BUG= 692621 

Review-Url: https://codereview.chromium.org/2767373002
Cr-Commit-Position: refs/heads/master@{#459793}

[modify] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/browser/BUILD.gn
[modify] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/browser/background_fetch/background_fetch_context.cc
[modify] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/browser/background_fetch/background_fetch_context.h
[modify] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/browser/background_fetch/background_fetch_data_manager.cc
[modify] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/browser/background_fetch/background_fetch_data_manager.h
[add] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/browser/background_fetch/background_fetch_data_manager_unittest.cc
[modify] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/browser/background_fetch/background_fetch_job_controller.cc
[modify] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/browser/background_fetch/background_fetch_job_controller.h
[modify] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/browser/background_fetch/background_fetch_job_controller_unittest.cc
[delete] https://crrev.com/97eaf60663ebf818732a387b27151150404cdfac/content/browser/background_fetch/background_fetch_job_data.cc
[delete] https://crrev.com/97eaf60663ebf818732a387b27151150404cdfac/content/browser/background_fetch/background_fetch_job_data.h
[delete] https://crrev.com/97eaf60663ebf818732a387b27151150404cdfac/content/browser/background_fetch/background_fetch_job_data_unittest.cc
[modify] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/browser/background_fetch/background_fetch_job_info.cc
[modify] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/browser/background_fetch/background_fetch_job_info.h
[add] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/browser/background_fetch/background_fetch_job_response_data.cc
[add] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/browser/background_fetch/background_fetch_job_response_data.h
[modify] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/browser/background_fetch/background_fetch_request_info.cc
[modify] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/browser/background_fetch/background_fetch_request_info.h
[modify] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/public/test/fake_download_item.cc
[modify] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/public/test/fake_download_item.h
[modify] https://crrev.com/4a4b593243e2acdedd593b84db51de418a801663/content/test/BUILD.gn

Project Member

Comment 8 by bugdroid1@chromium.org, Mar 27 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1aa34de9d58f09594f907e6aff43ca07c798164d

commit 1aa34de9d58f09594f907e6aff43ca07c798164d
Author: harkness <harkness@chromium.org>
Date: Mon Mar 27 17:18:19 2017

Added ServiceWorkerResponses to GetJobResponse callback

This CL does two things. First, it creates the ServiceWorkerRepsonse
objects corresponding to each RequestInfo structure and fills out partial
data there.

Second, it removes the asynchronous calls to build each file backed blob
in favor of a single call which inititalizes the blob storage context. A
future CL will move that initialization into the BackgroundFetchContext
so that the DataManager doesn't need to know about the BrowserContext.

Also added unit tests for the response.

BUG= 692621 

Review-Url: https://codereview.chromium.org/2774263003
Cr-Commit-Position: refs/heads/master@{#459813}

[modify] https://crrev.com/1aa34de9d58f09594f907e6aff43ca07c798164d/content/browser/background_fetch/background_fetch_data_manager.cc
[modify] https://crrev.com/1aa34de9d58f09594f907e6aff43ca07c798164d/content/browser/background_fetch/background_fetch_data_manager.h
[modify] https://crrev.com/1aa34de9d58f09594f907e6aff43ca07c798164d/content/browser/background_fetch/background_fetch_data_manager_unittest.cc
[modify] https://crrev.com/1aa34de9d58f09594f907e6aff43ca07c798164d/content/browser/background_fetch/background_fetch_job_response_data.cc
[modify] https://crrev.com/1aa34de9d58f09594f907e6aff43ca07c798164d/content/browser/background_fetch/background_fetch_job_response_data.h

Comment 9 by peter@chromium.org, Mar 29 2017

Status: Fixed (was: Available)
This also has been hooked up, despite a bunch of remaining TODOs to tighten up our integration. Individual bugs for such process seems better.

Sign in to add a comment