Jake started adding these to the spec here: https://github.com/WICG/background-fetch/commit/51929238a49c50a13a9dcdd1788646d930d22966 Let's implement them. Note that we'll want to support the (now renamed) `totalDownloadSize` for a little while to enable websites to update.
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/acdf76e1b5592b15eed80cb566da627599f131a7 commit acdf76e1b5592b15eed80cb566da627599f131a7 Author: Peter Beverloo <peter@chromium.org> Date: Mon Oct 02 14:34:29 2017 Implement the detailed progress values for Background Fetch This updates our implementation with the recent spec changes. Notably: * BackgroundFetchRegistration gets an `onprogress` event. * `totalDownloadSize` has been renamed to `downloadTotal`. * `uploadTotal`, `uploaded` and `downloaded` were added to BGReg. The old `totalDownloadSize` property has been kept as-is because there are a few demos out there that depend on it. They'll be removed soon. This CL only adjusts the Web exposed properties. In the next CL I'll add the observer mechanism that will power the progress events, after which we can make BackgroundFetchRegistration a live object and ensure that there's only one instance of it for a given execution context. BUG= 768273 Change-Id: I9a31f69441909e6cf41a63a3a50b6e31a8a1c574 Reviewed-on: https://chromium-review.googlesource.com/690160 Commit-Queue: Peter Beverloo <peter@chromium.org> Reviewed-by: John Mellor <johnme@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Kentaro Hara <haraken@chromium.org> Cr-Commit-Position: refs/heads/master@{#505604} [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/content/browser/background_fetch/background_fetch_context.cc [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/content/browser/background_fetch/background_fetch_data_manager.cc [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/content/browser/background_fetch/background_fetch_service_unittest.cc [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/content/common/background_fetch/background_fetch_struct_traits.cc [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/content/common/background_fetch/background_fetch_struct_traits.h [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/content/common/background_fetch/background_fetch_struct_traits_unittest.cc [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/content/common/background_fetch/background_fetch_types.h [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces-expected.txt [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces-worker.https-expected.txt [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces.idl [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces.worker-expected.txt [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/LayoutTests/external/wpt/background-fetch/interfaces.worker.js [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-fetch.https.html [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/LayoutTests/http/tests/background_fetch/background-fetch-manager-get.https.html [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/Source/modules/EventTargetModulesFactory.json5 [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchOptions.idl [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.cpp [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.h [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.idl [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchTypeConverters.cpp [modify] https://crrev.com/acdf76e1b5592b15eed80cb566da627599f131a7/third_party/WebKit/public/platform/modules/background_fetch/background_fetch.mojom
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/83ee6643c49ed68d71db8ea259f43f0562645187 commit 83ee6643c49ed68d71db8ea259f43f0562645187 Author: Peter Beverloo <peter@chromium.org> Date: Wed Oct 11 20:23:17 2017 Background Fetch: Infrastructure for the progress event This CL implements the `progress` event for BackgroundFetchRegistration objects and hooks them up with the browser process through a new BackgroundFetchRegistrationClient. It's a simple Event that the developer gets whenever the progress properties (uploadTotal, uploaded, downloadTotal and downloaded) change. A third CL in this series will hook it up with the Download Service, at which point we'll actually fire the events and can provide proper testing. TBR=avi (file addition in BUILD.gn) BUG= 768273 Change-Id: I7a97024747329a55efdc3d5b3d0eee15d171205a Reviewed-on: https://chromium-review.googlesource.com/700269 Commit-Queue: Peter Beverloo <peter@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: John Mellor <johnme@chromium.org> Cr-Commit-Position: refs/heads/master@{#508092} [modify] https://crrev.com/83ee6643c49ed68d71db8ea259f43f0562645187/content/browser/BUILD.gn [modify] https://crrev.com/83ee6643c49ed68d71db8ea259f43f0562645187/content/browser/background_fetch/background_fetch_context.cc [modify] https://crrev.com/83ee6643c49ed68d71db8ea259f43f0562645187/content/browser/background_fetch/background_fetch_context.h [add] https://crrev.com/83ee6643c49ed68d71db8ea259f43f0562645187/content/browser/background_fetch/background_fetch_registration_notifier.cc [add] https://crrev.com/83ee6643c49ed68d71db8ea259f43f0562645187/content/browser/background_fetch/background_fetch_registration_notifier.h [add] https://crrev.com/83ee6643c49ed68d71db8ea259f43f0562645187/content/browser/background_fetch/background_fetch_registration_notifier_unittest.cc [modify] https://crrev.com/83ee6643c49ed68d71db8ea259f43f0562645187/content/browser/background_fetch/background_fetch_service_impl.cc [modify] https://crrev.com/83ee6643c49ed68d71db8ea259f43f0562645187/content/browser/background_fetch/background_fetch_service_impl.h [modify] https://crrev.com/83ee6643c49ed68d71db8ea259f43f0562645187/content/test/BUILD.gn [modify] https://crrev.com/83ee6643c49ed68d71db8ea259f43f0562645187/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchBridge.cpp [modify] https://crrev.com/83ee6643c49ed68d71db8ea259f43f0562645187/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchBridge.h [modify] https://crrev.com/83ee6643c49ed68d71db8ea259f43f0562645187/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.cpp [modify] https://crrev.com/83ee6643c49ed68d71db8ea259f43f0562645187/third_party/WebKit/Source/modules/background_fetch/BackgroundFetchRegistration.h [add] https://crrev.com/83ee6643c49ed68d71db8ea259f43f0562645187/third_party/WebKit/Source/modules/background_fetch/DEPS [modify] https://crrev.com/83ee6643c49ed68d71db8ea259f43f0562645187/third_party/WebKit/public/platform/modules/background_fetch/background_fetch.mojom
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a commit 5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a Author: John Mellor <johnme@chromium.org> Date: Thu Oct 12 20:03:00 2017 Hook up progress events with the BGFetchRegistrationNotifier - DataManager now stores and updates |downloaded| bytes whenever a requests completes (in-progress requests are handled separately). - JobController now stores and updates |downloaded| bytes for in-progress downloads only. Additionally, it caches all of the values above, and hence now delivers progress events to JavaScript without reading from the database. - DataManager fills in the |downloaded| values of BackgroundFetchRegistration objects it compiles, from its own information and also querying in-progress JobControllers. - BackgroundFetchContext now delegates all creation of BackgroundFetchRegistration objects to the DataManager. BUG= 768273 Change-Id: Ia38a9014d7ca6dc754ee4c14fb3b1ba8708131f8 Reviewed-on: https://chromium-review.googlesource.com/713856 Commit-Queue: Peter Beverloo <peter@chromium.org> Reviewed-by: Peter Beverloo <peter@chromium.org> Reviewed-by: Dan Elphick <delphick@chromium.org> Cr-Commit-Position: refs/heads/master@{#508413} [modify] https://crrev.com/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a/content/browser/background_fetch/background_fetch_context.cc [modify] https://crrev.com/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a/content/browser/background_fetch/background_fetch_context.h [modify] https://crrev.com/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a/content/browser/background_fetch/background_fetch_data_manager.cc [modify] https://crrev.com/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a/content/browser/background_fetch/background_fetch_data_manager.h [modify] https://crrev.com/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a/content/browser/background_fetch/background_fetch_data_manager_unittest.cc [modify] https://crrev.com/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a/content/browser/background_fetch/background_fetch_delegate_proxy.cc [modify] https://crrev.com/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a/content/browser/background_fetch/background_fetch_delegate_proxy.h [modify] https://crrev.com/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a/content/browser/background_fetch/background_fetch_delegate_proxy_unittest.cc [modify] https://crrev.com/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a/content/browser/background_fetch/background_fetch_job_controller.cc [modify] https://crrev.com/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a/content/browser/background_fetch/background_fetch_job_controller.h [modify] https://crrev.com/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a/content/browser/background_fetch/background_fetch_job_controller_unittest.cc [modify] https://crrev.com/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a/content/browser/background_fetch/background_fetch_registration_notifier.cc [modify] https://crrev.com/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a/content/browser/background_fetch/background_fetch_registration_notifier.h [modify] https://crrev.com/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a/content/browser/background_fetch/background_fetch_registration_notifier_unittest.cc [modify] https://crrev.com/5438b0c1ebacfac4acabcd5127e2a4af3b0a3c8a/content/browser/background_fetch/mock_background_fetch_delegate.cc
Comment 1 by bugdroid1@chromium.org
, Oct 2 2017