New issue
Advanced search Search tips

Issue 667310 link

Starred by 0 users

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Feature

Blocking:
issue 624696



Sign in to add a comment

Use per-frame WebTaskRunner in core/workers

Project Member Reported by nhiroki@chromium.org, Nov 21 2016

Issue description

Project Member

Comment 1 by bugdroid1@chromium.org, Nov 28 2016

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

commit 409972dd9d6a640a5854d74b142bef19e25a36b5
Author: nhiroki <nhiroki@chromium.org>
Date: Mon Nov 28 04:37:27 2016

Worker: Provide a way to access parent frame task runners from a worker thread

To use per-frame task runners on a worker thread, this CL provides a way to
access parent frame task runners from a worker thread. To be specific,
WorkerReportingProxy will have a new interface getParentFrameTaskRunners() and
classes on a worker thread will post a task using the interface.

This is a part of the project to migrate to per-frame task scheduler. A general
design doc about the project is available here:
https://docs.google.com/document/d/10It1DFRP7H3gev9hQA-7dtTcvcMFhrxuCt3-k21yjgQ/edit?usp=sharing

BUG= 667310 

Review-Url: https://codereview.chromium.org/2513413003
Cr-Commit-Position: refs/heads/master@{#434604}

[modify] https://crrev.com/409972dd9d6a640a5854d74b142bef19e25a36b5/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
[modify] https://crrev.com/409972dd9d6a640a5854d74b142bef19e25a36b5/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
[modify] https://crrev.com/409972dd9d6a640a5854d74b142bef19e25a36b5/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
[modify] https://crrev.com/409972dd9d6a640a5854d74b142bef19e25a36b5/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h
[modify] https://crrev.com/409972dd9d6a640a5854d74b142bef19e25a36b5/third_party/WebKit/Source/core/workers/WorkerReportingProxy.h
[modify] https://crrev.com/409972dd9d6a640a5854d74b142bef19e25a36b5/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h
[modify] https://crrev.com/409972dd9d6a640a5854d74b142bef19e25a36b5/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThreadTest.cpp
[modify] https://crrev.com/409972dd9d6a640a5854d74b142bef19e25a36b5/third_party/WebKit/Source/modules/webaudio/AudioWorkletThreadTest.cpp
[modify] https://crrev.com/409972dd9d6a640a5854d74b142bef19e25a36b5/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
[modify] https://crrev.com/409972dd9d6a640a5854d74b142bef19e25a36b5/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h
[modify] https://crrev.com/409972dd9d6a640a5854d74b142bef19e25a36b5/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
[modify] https://crrev.com/409972dd9d6a640a5854d74b142bef19e25a36b5/third_party/WebKit/Source/web/WebSharedWorkerImpl.h

Project Member

Comment 2 by bugdroid1@chromium.org, Nov 28 2016

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

commit 6a8002607cc8e991e382adb29c7c5f13ee55da58
Author: nhiroki <nhiroki@chromium.org>
Date: Mon Nov 28 05:23:19 2016

Worker: Deprecate PostTaskToMainExecutionContext

This CL deprecates PostTaskToMainExecutionContext on InProcessWorkerObjectProxy
and ThreadedWorkletObjectProxy in favor of per-frame task runners. This is a
part of the project to migrate to per-frame scheduler. A general design doc
about the project is available here:
https://docs.google.com/document/d/10It1DFRP7H3gev9hQA-7dtTcvcMFhrxuCt3-k21yjgQ/edit?usp=sharing

This CL also moves UseCounter::count and UseCounter::countDeprecation calls from
DedicatedWorkerGlobalScope to ThreadedMessagingProxyBase because (1) per-frame
task runners don't provide an execution context to a posted task like
ExecutionContextTask (PostTaskToMainExecutionContext) and need an alternative
way to get it, and (2) communications between the main thread and worker threads
should be consolidated to MessaginProxy and ObjectProxy.

BONUS: This cleanup makes it easier to share UseCounter code among workers and
worklets.

BUG= 376039 , 657694,  667310 ,  667357 

Review-Url: https://codereview.chromium.org/2535653002
Cr-Commit-Position: refs/heads/master@{#434607}

[modify] https://crrev.com/6a8002607cc8e991e382adb29c7c5f13ee55da58/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.cpp
[modify] https://crrev.com/6a8002607cc8e991e382adb29c7c5f13ee55da58/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
[modify] https://crrev.com/6a8002607cc8e991e382adb29c7c5f13ee55da58/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
[modify] https://crrev.com/6a8002607cc8e991e382adb29c7c5f13ee55da58/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp
[modify] https://crrev.com/6a8002607cc8e991e382adb29c7c5f13ee55da58/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.h
[modify] https://crrev.com/6a8002607cc8e991e382adb29c7c5f13ee55da58/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
[modify] https://crrev.com/6a8002607cc8e991e382adb29c7c5f13ee55da58/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h

Labels: -Pri-3 Pri-2
Status: Started (was: Assigned)
Project Member

Comment 5 by bugdroid1@chromium.org, Dec 2 2016

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

commit 1f1dcb17059558c87c9e6f8ee45888de1f71c2d3
Author: tzik <tzik@chromium.org>
Date: Fri Dec 02 08:52:15 2016

Move InspectorTask handling from MainThreadTaskRunner to Document

MainThreadTaskRunner handles the task suspension, cancellation, and
instrumentation of Inspector for a posted task. However, a task posted
via MainThreadTaskRunner::postInspectorTask doesn't need the task
suspension and instrumentation.

This CL moves InspectorTask handling from MainThreadTaskRunner to
Document for smaller MainThreadTaskRunner.

BUG= 667310 

Review-Url: https://codereview.chromium.org/2534803002
Cr-Commit-Position: refs/heads/master@{#435889}

[modify] https://crrev.com/1f1dcb17059558c87c9e6f8ee45888de1f71c2d3/third_party/WebKit/Source/core/dom/Document.cpp
[modify] https://crrev.com/1f1dcb17059558c87c9e6f8ee45888de1f71c2d3/third_party/WebKit/Source/core/dom/Document.h
[modify] https://crrev.com/1f1dcb17059558c87c9e6f8ee45888de1f71c2d3/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.cpp
[modify] https://crrev.com/1f1dcb17059558c87c9e6f8ee45888de1f71c2d3/third_party/WebKit/Source/core/dom/MainThreadTaskRunner.h
[modify] https://crrev.com/1f1dcb17059558c87c9e6f8ee45888de1f71c2d3/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
[modify] https://crrev.com/1f1dcb17059558c87c9e6f8ee45888de1f71c2d3/third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.cpp
[modify] https://crrev.com/1f1dcb17059558c87c9e6f8ee45888de1f71c2d3/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
[modify] https://crrev.com/1f1dcb17059558c87c9e6f8ee45888de1f71c2d3/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
[modify] https://crrev.com/1f1dcb17059558c87c9e6f8ee45888de1f71c2d3/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp

Project Member

Comment 6 by bugdroid1@chromium.org, Dec 2 2016

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

commit f4854006cdb8ca413396208be019dd99d4ea6145
Author: nhiroki <nhiroki@chromium.org>
Date: Fri Dec 02 11:22:13 2016

Worker: Use per-frame task runners for ThreadedWorklets

This is a part of the project to migrate to per-frame scheduler.
A general design doc about the project is available here:
https://docs.google.com/document/d/10It1DFRP7H3gev9hQA-7dtTcvcMFhrxuCt3-k21yjgQ/edit?usp=sharing

BUG= 667310 

Review-Url: https://codereview.chromium.org/2542813006
Cr-Commit-Position: refs/heads/master@{#435914}

[modify] https://crrev.com/f4854006cdb8ca413396208be019dd99d4ea6145/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
[modify] https://crrev.com/f4854006cdb8ca413396208be019dd99d4ea6145/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h

Project Member

Comment 7 by bugdroid1@chromium.org, Dec 8 2016

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

commit a36ee3740ceb393c22500b5ef4e170aafd79c566
Author: nhiroki <nhiroki@chromium.org>
Date: Thu Dec 08 05:17:54 2016

Worker: Fix cross-thread violations on ObjectProxy

This CL fixes 2 cross-thread violation issues:

1) This passes ParentFrameTaskRunners from MessagingProxy on the main thread to
   ObjectProxy on the worker thread so that the object proxy can post a task to
   the main thread without accessing a pointer to the messaging proxy.

2) This stops InProcessWorkerObjectProxy on the worker thread from accessing
   Document on the main thread and removes getExecutionContext().

BUG= 667310 

Review-Url: https://codereview.chromium.org/2546043002
Cr-Commit-Position: refs/heads/master@{#437187}

[modify] https://crrev.com/a36ee3740ceb393c22500b5ef4e170aafd79c566/third_party/WebKit/Source/core/workers/InProcessWorkerMessagingProxy.cpp
[modify] https://crrev.com/a36ee3740ceb393c22500b5ef4e170aafd79c566/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
[modify] https://crrev.com/a36ee3740ceb393c22500b5ef4e170aafd79c566/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
[modify] https://crrev.com/a36ee3740ceb393c22500b5ef4e170aafd79c566/third_party/WebKit/Source/core/workers/ThreadedWorkletMessagingProxy.cpp
[modify] https://crrev.com/a36ee3740ceb393c22500b5ef4e170aafd79c566/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
[modify] https://crrev.com/a36ee3740ceb393c22500b5ef4e170aafd79c566/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h
[modify] https://crrev.com/a36ee3740ceb393c22500b5ef4e170aafd79c566/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp

Project Member

Comment 8 by bugdroid1@chromium.org, Dec 13 2016

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

commit 200baa21d49f1a2688a33bb64f4b689fdae69119
Author: tzik <tzik@chromium.org>
Date: Tue Dec 13 12:59:34 2016

Use ParentFrameTaskRunners in WorkerLoaderProxyProvider::postTaskToLoader impls

Implementations of WorkerLoaderProxyProvider::postTaskToLoader have used
ExecutionContext::postTask to post tasks to the main thread. However,
the posted tasks are unexpectedly throttled, and that delays the startup
time of service workers.
This CL replaces ExecutionContext::postTask there with ParentFrameTaskRunners
and WebTaskRunner::postTask, so that the posted task is routed to suitable
task runners.

BUG= 667310 ,  671084 

Review-Url: https://codereview.chromium.org/2574703002
Cr-Commit-Position: refs/heads/master@{#438146}

[modify] https://crrev.com/200baa21d49f1a2688a33bb64f4b689fdae69119/third_party/WebKit/Source/core/dom/ExecutionContextTask.h
[modify] https://crrev.com/200baa21d49f1a2688a33bb64f4b689fdae69119/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp
[modify] https://crrev.com/200baa21d49f1a2688a33bb64f4b689fdae69119/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp
[modify] https://crrev.com/200baa21d49f1a2688a33bb64f4b689fdae69119/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp
[modify] https://crrev.com/200baa21d49f1a2688a33bb64f4b689fdae69119/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp

Cc: tzik@chromium.org
Status: Fixed (was: Started)
All Document::postTask() calls under core/workers were replaced with ParentFrameTaskRunners :)
Labels: M-57
Project Member

Comment 11 by bugdroid1@chromium.org, Jan 24 2017

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

commit 22d251e18ae5a0b5f21a31a4875156c36b884f03
Author: nhiroki <nhiroki@chromium.org>
Date: Tue Jan 24 07:15:52 2017

Worker: Move ParentFrameTaskRunners from WorkerReportingProxy to ObjectProxy

WorkerReportingProxy::getParentFrameTaskRunners() was introduced by [1] in order
to provide a way to post a task from a worker thread to the main thread. This is
still useful, but would be misplaced as a review comment[2].

This CL removes WorkerReportingProxy::getParentFrameTaskRunners() and instead
each ObjectProxy and WorkerThread has its own ParentFrameTaskRunners instance if
necessary. MessagingProxy on the main thread creates ParentFrameTaskRunners and
then passes it to ObjectProxy and WorkerThread on a worker thread separately.

[1] https://codereview.chromium.org/2513413003/
[2] https://codereview.chromium.org/2513413003/#msg40

BUG= 667310 

Review-Url: https://codereview.chromium.org/2539443004
Cr-Commit-Position: refs/heads/master@{#445673}

[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/core/workers/DedicatedWorkerMessagingProxy.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/core/workers/DedicatedWorkerThread.h
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/core/workers/SharedWorkerThread.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/core/workers/SharedWorkerThread.h
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/core/workers/ThreadedObjectProxyBase.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/core/workers/ThreadedObjectProxyBase.h
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/core/workers/ThreadedWorkletTest.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/core/workers/WorkerReportingProxy.h
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/core/workers/WorkerThread.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/core/workers/WorkerThread.h
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/compositorworker/AbstractAnimationWorkletThread.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/compositorworker/AbstractAnimationWorkletThread.h
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletMessagingProxy.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThread.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThread.h
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThreadTest.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerMessagingProxy.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.h
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerThread.h
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/webaudio/AudioWorkletMessagingProxy.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.h
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/modules/webaudio/AudioWorkletThreadTest.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
[modify] https://crrev.com/22d251e18ae5a0b5f21a31a4875156c36b884f03/third_party/WebKit/Source/web/WebSharedWorkerImpl.h

Sign in to add a comment