ServiceWorker: Notify errors on sending installed scripts to renderer

Desktop / Chromium - Makoto Shimazu [chromium.org] - 7 August 2017 23:00 EDT

This is 10th patch of script streaming project split off from https://chromium-review.googlesource.com/c/538477. Design doc: https://docs.google.com/document/d/1BbETxB2K1GeGUv4XIvGGforAJRRgYSNX5x4vPTGsCPU/edit

This patch fixes error handling on ServiceWorkerInstalledScriptsSender. The renderer can know the browser-side error by- Disconnection of mojom::ServiceWorkerInstalledScriptsManager before TransferInstalledScript.
- Disconnection of each data pipe after TransferInstalledScript.

For telling the data transfer is completed successfully, this patch adds body_size and meta_data_size to mojom::ServiceWorkerScriptInfo. If total amount of received data is different from the size when the data pipe is closed, it means an error happened during sending the body or meta data. In that case, ThreadSafeScriptContainer returns nullptr. That results in fallback to the ResourceLoader path (a follow-up patch will change this to result in error instead). If an error happens for the main script, the worker will be terminated.

Bug: 683037 Change-Id: I3fddcab920d272be0187d3b48380aa9136ab0f4c Reviewed-on: https://chromium-review.googlesource.com/579307 Commit-Queue: Makoto Shimazu

765239a ServiceWorker: Notify errors on sending installed scripts to renderer
.../service_worker_installed_scripts_sender.cc | 98 ++++++++-----
.../service_worker_installed_scripts_sender.h | 32 +++--
...ice_worker_installed_scripts_sender_unittest.cc | 154 +++++++++++++++++++--
.../service_worker/service_worker_metrics.cc | 15 +-
.../service_worker/service_worker_metrics.h | 5 +
.../service_worker/service_worker_version.cc | 4 +
.../service_worker_installed_scripts_manager.mojom | 2 +
...ervice_worker_installed_scripts_manager_impl.cc | 57 ++++++--
...rker_installed_scripts_manager_impl_unittest.cc | 140 ++++++++++++++++++-
.../Source/core/workers/InstalledScriptsManager.h | 4 +-
.../WebKit/Source/core/workers/WorkerThread.cpp | 51 ++++---
tools/metrics/histograms/enums.xml | 10 ++
tools/metrics/histograms/histograms.xml | 11 ++
13 files changed, 488 insertions(+), 95 deletions(-)

Upstream: git.chromium.org


  • Share