New issue
Advanced search Search tips

Issue 820329 link

Starred by 4 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 2
Type: Feature

Blocked on:
issue 882467
issue 719052

Blocking:
issue 538751
issue 692909
issue 853518


Participants' hotlists:
Worker-OffTheMainThread


Sign in to add a comment

Remove a shadow frame for an installed service worker

Project Member Reported by shimazu@chromium.org, Mar 9 2018

Issue description

Shadow frame used to be used for issuing network requests, but for now it's used only for sync request for importScripts because off-main thread fetch has been launched.

Currently importScripts() in an installed worker is asking ServiceWorkerInstalledScriptManager first, and if the scripts are missing (not installed), it starts sync network requests as a fallback.
However, the spec says importScripts can "return a network error" if it's an installed worker.
https://w3c.github.io/ServiceWorker/#importscripts

That means we can avoid to create a shadow frame for installed worker. It'll make service worker startup time faster.
 
Blocking: 538751
Cc: horo@chromium.org
Labels: -OS-iOS -Pri-3 Pri-2
Re-prioritized this for aligning to 538751. 
Blockedon: 719052
Do we know which would be more work, fixing 538751 in general or doing this one for installed workers?

Unsupporting importScripts for new scripts after install is tracked at 719052.
As far as I quickly read through the code, this one for installed workers seems less than fixing 538751 in general since what we need is basically just skipping the shadow page creation. If we remove the shadow page in general, we need to change what we are currently doing for loading the main script etc.

horo@, do you have more thoughts?
Ah, DevTools support might also be a problem?

Comment 6 by horo@chromium.org, Mar 9 2018

Ah, I forgot about WebSocket.
We can't remove the shadow page until we move WebSocket on worker thread off the main thread.

When I created a POC patch of off-main-thread-start-worker 1.5 years ago, I delayed the shadow page creation and introduced a pending task queue in the main thread to keep the loading task until the shadow page will be initialized.
https://codereview.chromium.org/2118243002/diff/600001/third_party/WebKit/Source/web/WebIsolatedWorkerImpl.cpp#newcode89

I think this logic of delaying the shadow page initialization can make the service worker creation faster.
Blocking: 853518
Owner: nhiroki@chromium.org
Status: Started (was: Available)
I have a half-baked patch:
https://chromium-review.googlesource.com/c/chromium/src/+/1146531
Project Member

Comment 9 by bugdroid1@chromium.org, Jul 27

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

commit 15ab44877228859c9f8be9742db75943dd66c666
Author: Hiroki Nakagawa <nhiroki@chromium.org>
Date: Fri Jul 27 07:43:03 2018

Loader: Remove ThreadableLoadingContext

ThreadableLoadingContext has been used for encapsulating
ExecutionContext-dependent things for loaders. Thanks to recent
off-the-main-thread efforts, now most of resource loading can run
off-the-main-thread and this abstraction is no longer necessary.

In addition to removing unnecessary code, this cleanup is useful for removing
WorkerShadowPage for installed service workers (issue 820329), and introducing
FetchClientSettingsObject in loaders (issue 845285).

Bug: 820329, 845285
Change-Id: Id6e329c9c783057ba68abab78a2e86054a3b0c29
TBR: haraken@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/1150957
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Adam Rice <ricea@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578559}
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value_threaded_test.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/loader/BUILD.gn
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/loader/threadable_loader.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/loader/threadable_loader.h
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/loader/threadable_loader_test.cc
[delete] https://crrev.com/2fd3efecf7240ef64aec96015ec4052b275e49ab/third_party/blink/renderer/core/loader/threadable_loading_context.cc
[delete] https://crrev.com/2fd3efecf7240ef64aec96015ec4052b275e49ab/third_party/blink/renderer/core/loader/threadable_loading_context.h
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/workers/dedicated_worker_messaging_proxy.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/workers/dedicated_worker_test.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/workers/dedicated_worker_thread.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/workers/dedicated_worker_thread.h
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/workers/shared_worker_thread.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/workers/shared_worker_thread.h
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/workers/threaded_messaging_proxy_base.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/workers/threaded_messaging_proxy_base.h
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/workers/threaded_worklet_test.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/workers/worker_thread.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/workers/worker_thread.h
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/workers/worker_thread_test.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/core/workers/worker_thread_test_helper.h
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope_test.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/modules/animationworklet/animation_worklet_messaging_proxy.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/modules/animationworklet/animation_worklet_thread.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/modules/animationworklet/animation_worklet_thread.h
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/modules/animationworklet/animation_worklet_thread_test.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/modules/service_worker/service_worker_thread.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/modules/service_worker/service_worker_thread.h
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope_test.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/modules/webaudio/audio_worklet_messaging_proxy.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/modules/webaudio/audio_worklet_thread.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/modules/webaudio/audio_worklet_thread.h
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc
[modify] https://crrev.com/15ab44877228859c9f8be9742db75943dd66c666/third_party/blink/renderer/modules/websockets/websocket_channel_impl.h

Blockedon: 882467

Sign in to add a comment