New issue
Advanced search Search tips

Issue 924041 link

Starred by 2 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocked on:
issue 906850


Participants' hotlists:
Worker-OffTheMainThread


Sign in to add a comment

Implement off-the-main-thread shared worker script fetch

Project Member Reported by nhiroki@chromium.org, Today (21 hours ago)

Issue description

In the current implementation, top-level shared worker script is fetched from the main thread via WorkerClassicScriptLoader (see WebSharedWorkerImpl::OnShadowPageInitialized()). To avoid dependencies on the main thread, that should be done from the worker thread.

Implementation plan
1) Add a runtime flag like OffMainThreadSharedWorkerScriptFetch, and wrap following steps with flag checks.
2) In WebSharedWorkerImpl::OnShadowPageInitialize(), bypass WorkerClassicScriptLoader creation, and call client_->WaitForServiceWorkerControllerInfo() and WebSharedWorkerImpl::ContinueOnScriptLoaderFinished().
3) In WebSharedWorkerImpl::StartWorkerThread(), call WorkerThread::ImportClassicScript() instead of WorkerThread::EvaluateClassicScript(). The function eventually fetches a worker script and evaluates it on the worker thread.
4) We also need to plumb PlzSharedWorker in the case where NetworkService is enabled.

Testing plan
- Run web_tests with the OffMainThreadSharedWorkerScriptFetch flag. For references, see "omt-worker-fetch" in VirtualTestSuites ("omt-worker-fetch" is the test setting for off-the-main-thread dedicated worker script fetch).
- Run web_tests with the OffMainThreadSharedWorkerScriptFetch and NetworkService flags for PlzSharedWorker.

References
- dedicated_worker.cc does the similar thing for off-the-main-thread dedicated worker script fetch. Search the code by RuntimeEnabledFeatures::OffMainThreadWorkerScriptFetchEnabled.
 

Comment 1 by nhiroki@chromium.org, Today (16 hours ago)

Owner: nhiroki@chromium.org
Status: Started (was: Available)

Comment 2 by hirosh...@chromium.org, Today (9 hours ago)

Blockedon: 906850

Sign in to add a comment