New issue
Advanced search Search tips

Issue 753350 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 835717
Owner:
Closed: Jun 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Feature

Blocked on:
issue 748415



Sign in to add a comment

Loads worker scripts in WorkerGlobalScope

Project Member Reported by shimazu@chromium.org, Aug 8 2017

Issue description

Currently worker scripts is loaded at WorkerThread (main script) and WorkerGlobalScope (importSciprts) and they have each loading code.
This issue is to introduce a new class for script loads to unify them. 
Its instance will be shared among WorkerThread and WorkerGlobalScope.
 
Components: -Blink>ServiceWorker Blink>Workers
This would be useful not only for service workers but also for dedicated workers and shared workers.
Blockedon: 748415
Cc: nhiroki@chromium.org
Labels: -M-62 M-63
Summary: Loads worker scripts in WorkerGlobalScope (was: Factor out code to load worker scripts into a new class)
The motivation of this is basically that we'd like to put codes for loading scripts into one place.
nhiroki@ is currently working on it by moving script evaluation into WorkerGlobalScope. Also, the main reason why we need to load the main script on the main thread is we've implemented byte-to-byte check by using the same code with starting worker. 
If we can remove the byte-to-byte checking from the renderer, we don't need loading scripts from the main thread, so we can move all of the code to load scripts to the worker thread, so it means WorkerGlobalScope will be able to handle all of script loads. 
So, let's change the summary and start to work on this after byte-to-byte checking is implemented on the browser process.

//  crbug.com/748415  is a bit different from byte-to-byte checking on the browser, but probably it includes that.
Cc: -nhiroki@chromium.org shimazu@chromium.org
Owner: nhiroki@chromium.org
Status: Started (was: Assigned)
Hiroki-san has already started working on this issue.
https://crrev.com/c/701854
Project Member

Comment 4 by bugdroid1@chromium.org, Oct 5 2017

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

commit e4404c2f93e2d2ccacf15b07c834bff8051ddb63
Author: Hiroki Nakagawa <nhiroki@chromium.org>
Date: Thu Oct 05 07:08:46 2017

ServiceWorker: Move InstalledScriptsManager access from WorkerThread to SWGlobalScope

For cleanup, this CL moves InstalledScriptsManager access from
WorkerThread::InitializeOnWorkerThread() to
ServiceWorkerGlobalScope::EvaluateClassicScript() because only ServiceWorker
needs to access the manager and placing it in EvaluateClassicScript() looks more
natural like importScripts().

<Motivation>

My final goal is to remove script evaluation code from WorkerThread and leave it
up to each owner of WorkerThread so that WorkerThead is no longer concerned with
how to evaluate scripts (i.e., "classic", "module", lazy eval for worklets).

For example, for DedicatedWorker, DedicatedWorkerMessagingProxy may post a task
to call WorkerGlobalScope::EvaluateClassicScript() or
WorkerGlobalScope::ImportModuleScript() (to be added later) based on
"WorkerType"[1] after initializing DedicatedWorkerThread.

[1] https://html.spec.whatwg.org/multipage/workers.html#workertype

Bug: 680046,  753350 ,  755054 
Change-Id: I546cbda16f09da66c3f94c319e498055e1f9d05b
Reviewed-on: https://chromium-review.googlesource.com/701854
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Makoto Shimazu <shimazu@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506670}
[modify] https://crrev.com/e4404c2f93e2d2ccacf15b07c834bff8051ddb63/third_party/WebKit/Source/core/workers/WorkerGlobalScope.h
[modify] https://crrev.com/e4404c2f93e2d2ccacf15b07c834bff8051ddb63/third_party/WebKit/Source/core/workers/WorkerThread.cpp
[modify] https://crrev.com/e4404c2f93e2d2ccacf15b07c834bff8051ddb63/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
[modify] https://crrev.com/e4404c2f93e2d2ccacf15b07c834bff8051ddb63/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.h
[modify] https://crrev.com/e4404c2f93e2d2ccacf15b07c834bff8051ddb63/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScopeProxy.cpp
[modify] https://crrev.com/e4404c2f93e2d2ccacf15b07c834bff8051ddb63/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.cpp
[modify] https://crrev.com/e4404c2f93e2d2ccacf15b07c834bff8051ddb63/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.h

Mergedinto: 835717
Status: Duplicate (was: Started)

Sign in to add a comment