New issue
Advanced search Search tips

Issue 667357 link

Starred by 0 users

Issue metadata

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



Sign in to add a comment

Support UseCounter for Worklets

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

Issue description

Worklets is a variant of in-process workers and it should be possible to reuse UseCounter mechanism of DedicatedWorkers for Worklets.
 
Owner: nhiroki@chromium.org
Status: Assigned (was: Available)
Rough idea:
  1) Move WorkerGlobalScope::countFeature() to WorkerOrWorkletGlobalScope
  2) Make UseCounter::count() call countFeature() for WorkerOrWorkletGlobalScope
  3) Move countOnDocument() in DedicatedWorkerGlobalScope.cpp to somewhere to share it among workers and worklets.
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 4 by bugdroid1@chromium.org, Dec 6 2016

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

commit 258056d1132c92efb77d9f93f26d19b33d438039
Author: nhiroki <nhiroki@chromium.org>
Date: Tue Dec 06 02:38:07 2016

Worker: Connect UseCounter to workers and worklets

This is a preparation CL for UseCounter support on workers and worklets, and
does not actually record API use on them yet.

This CL introduces new interfaces WorkerOrWorkletGlobalScope::countFeature() and
WorkerReportingProxy::countFeature() so that UseCounter can transparently report
API use to workers and worklets. After this change, call paths are as follows
(TODO comments will be addressed by subsequent CLs):

For DedicatedWorkers (Note: UseCounter is already enabled on DedicatedWorkers)
- UseCounter::countFeature()
  - WorkerGlobalScope::countFeature()
    - InProcessWorkerObjectProxy::countFeature()
      - (Worker Thread -> Main Thread)
      - ThreadedMessagingProxyBase::countFeature()
      - Record API use in a parent document's UseCounter.

For SharedWorkers
- UseCounter::countFeature()
  - WorkerGlobalScope::countFeature()
    - WebSharedWorkerImpl::countFeature()
    - TODO: Send an IPC message to the browser process and ask each connected
      document to record API use in its UseCounter.

For ServiceWorkers
- UseCounter::countFeature()
  - WorkerGlobalScope::countFeature()
    - ServiceWorkerGlobalScopeProxy::countFeature()
    - TODO: Send an IPC message to the browser process and ask each controlled
      document to record API use in its UseCounter.

For MainThreadWorklets
- UseCounter::countFeature()
  - MainThreadWorkletGlobalScope::countFeature()
  - TODO: A parent document is on the same thread, so just record API use in the
    document's UseCounter.

For ThreadedWorklets
- UseCounter::countFeature()
  - ThreadedWorkletGlobalScope::countFeature()
    - ThreadedWorkletObjectProxy::countFeature()
    - TODO: Post a task to report API use to a parent document on the main
      thread like DedicatedWorkers.

BUG= 376039 ,  667357 

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

[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/dom/ExecutionContext.h
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/frame/UseCounter.cpp
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/frame/UseCounter.h
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/BUILD.gn
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.cpp
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/DedicatedWorkerGlobalScope.h
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/MainThreadWorkletGlobalScope.cpp
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/MainThreadWorkletGlobalScope.h
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/ThreadedWorkletGlobalScope.cpp
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/ThreadedWorkletGlobalScope.h
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/WorkerGlobalScope.h
[add] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.h
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/WorkerReportingProxy.h
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/core/workers/WorkerThreadTestHelper.h
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/modules/compositorworker/AnimationWorkletThreadTest.cpp
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/modules/webaudio/AudioWorkletThreadTest.cpp
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
[modify] https://crrev.com/258056d1132c92efb77d9f93f26d19b33d438039/third_party/WebKit/Source/web/WebSharedWorkerImpl.h

Project Member

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

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

commit 9083392315f8b2ba599185c6b63af718ac4c6efb
Author: nhiroki <nhiroki@chromium.org>
Date: Fri Dec 09 09:29:50 2016

Worker: Factor out common functions into ThreadedObjectProxyBase

Several functions in InProcessWorkerObjectProxy and ThreadedWorkletObjectProxy
are common. This CL introduces ThreadedMessagingProxyBase class, factors out the
functions into the base class and makes the both proxies inherit it.

[Class relationships after this CL]

On MainThread                   / On WorkerThread
ThreadedMessagingProxyBase      / ThreadedObjectProxyBase
- InProcessWorkerMessagingProxy / - InProcessWorkerObjectProxy
- ThreadedWorkletMessagingProxy / - ThreadedWorkletObjectProxy

BUG= 667357 

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

[modify] https://crrev.com/9083392315f8b2ba599185c6b63af718ac4c6efb/third_party/WebKit/Source/core/workers/BUILD.gn
[modify] https://crrev.com/9083392315f8b2ba599185c6b63af718ac4c6efb/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
[modify] https://crrev.com/9083392315f8b2ba599185c6b63af718ac4c6efb/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
[add] https://crrev.com/9083392315f8b2ba599185c6b63af718ac4c6efb/third_party/WebKit/Source/core/workers/ThreadedObjectProxyBase.cpp
[add] https://crrev.com/9083392315f8b2ba599185c6b63af718ac4c6efb/third_party/WebKit/Source/core/workers/ThreadedObjectProxyBase.h
[modify] https://crrev.com/9083392315f8b2ba599185c6b63af718ac4c6efb/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
[modify] https://crrev.com/9083392315f8b2ba599185c6b63af718ac4c6efb/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.h

Project Member

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

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

commit 6b040dc1539e1dc96499e2050c9cf02551ac3cae
Author: nhiroki <nhiroki@chromium.org>
Date: Thu Dec 15 05:52:07 2016

Worker: Add unittests for UseCounter on DedicatedWorkerGlobalScope

BUG= 667357 

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

[modify] https://crrev.com/6b040dc1539e1dc96499e2050c9cf02551ac3cae/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp

Project Member

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

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

commit 3a6310b801c1b5d36c887cdbdd3528ed80867554
Author: nhiroki <nhiroki@chromium.org>
Date: Thu Dec 15 18:09:38 2016

Worker: Enable UseCounter for ThreadedWorkletGlobalScope

API use on the ThreadedWorkletGlobalScope is recorded in parent Document's
UseCounter.

Note that ThreadedWorkletGlobalScope hasn't been shipped yet and this
should not affect use counts in the real world.

BUG= 667357 
TBR=haraken@chromium.org

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

[modify] https://crrev.com/3a6310b801c1b5d36c887cdbdd3528ed80867554/third_party/WebKit/Source/core/BUILD.gn
[modify] https://crrev.com/3a6310b801c1b5d36c887cdbdd3528ed80867554/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
[modify] https://crrev.com/3a6310b801c1b5d36c887cdbdd3528ed80867554/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
[modify] https://crrev.com/3a6310b801c1b5d36c887cdbdd3528ed80867554/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.h
[modify] https://crrev.com/3a6310b801c1b5d36c887cdbdd3528ed80867554/third_party/WebKit/Source/core/workers/ThreadedObjectProxyBase.cpp
[modify] https://crrev.com/3a6310b801c1b5d36c887cdbdd3528ed80867554/third_party/WebKit/Source/core/workers/ThreadedObjectProxyBase.h
[modify] https://crrev.com/3a6310b801c1b5d36c887cdbdd3528ed80867554/third_party/WebKit/Source/core/workers/ThreadedWorkletGlobalScope.h
[modify] https://crrev.com/3a6310b801c1b5d36c887cdbdd3528ed80867554/third_party/WebKit/Source/core/workers/ThreadedWorkletObjectProxy.cpp
[add] https://crrev.com/3a6310b801c1b5d36c887cdbdd3528ed80867554/third_party/WebKit/Source/core/workers/ThreadedWorkletTest.cpp

Labels: M-57
Status: Fixed (was: Started)
Project Member

Comment 10 by bugdroid1@chromium.org, Dec 19 2016

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

commit ee81deeea47deea00c48f85c44bb7d17e82b4db0
Author: nhiroki <nhiroki@chromium.org>
Date: Mon Dec 19 06:51:00 2016

Worker: Supress gmock warnings in WorkerThreadTest

These warnings started emerging after:
https://codereview.chromium.org/2535093003

BUG= 376039 ,  667357 

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

[modify] https://crrev.com/ee81deeea47deea00c48f85c44bb7d17e82b4db0/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp

Sign in to add a comment