New issue
Advanced search Search tips

Issue 714551 link

Starred by 0 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Shared/ServiceWorkers should not send IPCs for already counted features

Project Member Reported by nhiroki@chromium.org, Apr 24 2017

Issue description

API use (UseCounter::Feature) on Shared/ServiceWorkerGlobalScope are propagated to connecting/controlling documents via the browser process and counted in their UseCounters.

This IPC message should be sent only one time per feature and "browser->document" part is actually implemented in that manner (see SharedWorkerHost::CountFeature and ServiceWorkerVersion::CountFeature), but "worker->browser" IPC is sent every time a feature is used. This is not efficient.
 
Cc: rbyers@chromium.org
Labels: M-60
Status: Started (was: Assigned)
NextAction: 2017-05-08
WIP CL: https://codereview.chromium.org/2857583003/

(I'll be OOO until May 8 and resume this work after that)
NextAction: ----
Now working...
Project Member

Comment 4 by bugdroid1@chromium.org, May 8 2017

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

commit c7acabe9f43065280edf2dee91ae53f6472dcf02
Author: nhiroki <nhiroki@chromium.org>
Date: Mon May 08 12:13:13 2017

Worker: Avoid sending IPC messages for features already counted

When a feature listed on UseCounter::Feature is used on
Shared/ServiceWorkerGlobalScope, it's reported to connecting/controlling
documents via the browser process and counted in their UseCounters.

These IPC messages should be sent only one time per feature, but unfortunately
"worker->browser" IPC is sent every time a feature is used. This is not
efficient.

This CL memorizes feature use in worker-side and avoids sending duplicate IPC
messages to the browser process.

<Example of the calling sequence>

(Some feature is used on ServiceWorkerGlobalScope)
UseCounter::CountFeature
- WorkerOrWorkletGlobalScope::CountFeature
  (memorizes feature use and returns early if it's already reported)
  - WorkerGlobalScope::ReportFeature
    - ServiceWorkerGlobalScopeProxy::CountFeature
      - ServiceWorkerContextClient (sends an IPC message to the browser)

BUG= 714551 

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

[modify] https://crrev.com/c7acabe9f43065280edf2dee91ae53f6472dcf02/third_party/WebKit/Source/core/workers/DedicatedWorkerTest.cpp
[modify] https://crrev.com/c7acabe9f43065280edf2dee91ae53f6472dcf02/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.h
[modify] https://crrev.com/c7acabe9f43065280edf2dee91ae53f6472dcf02/third_party/WebKit/Source/core/workers/MainThreadWorkletGlobalScope.cpp
[modify] https://crrev.com/c7acabe9f43065280edf2dee91ae53f6472dcf02/third_party/WebKit/Source/core/workers/MainThreadWorkletGlobalScope.h
[modify] https://crrev.com/c7acabe9f43065280edf2dee91ae53f6472dcf02/third_party/WebKit/Source/core/workers/MainThreadWorkletTest.cpp
[modify] https://crrev.com/c7acabe9f43065280edf2dee91ae53f6472dcf02/third_party/WebKit/Source/core/workers/ThreadedWorkletGlobalScope.cpp
[modify] https://crrev.com/c7acabe9f43065280edf2dee91ae53f6472dcf02/third_party/WebKit/Source/core/workers/ThreadedWorkletGlobalScope.h
[modify] https://crrev.com/c7acabe9f43065280edf2dee91ae53f6472dcf02/third_party/WebKit/Source/core/workers/ThreadedWorkletMessagingProxy.h
[modify] https://crrev.com/c7acabe9f43065280edf2dee91ae53f6472dcf02/third_party/WebKit/Source/core/workers/ThreadedWorkletTest.cpp
[modify] https://crrev.com/c7acabe9f43065280edf2dee91ae53f6472dcf02/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp
[modify] https://crrev.com/c7acabe9f43065280edf2dee91ae53f6472dcf02/third_party/WebKit/Source/core/workers/WorkerGlobalScope.h
[modify] https://crrev.com/c7acabe9f43065280edf2dee91ae53f6472dcf02/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
[modify] https://crrev.com/c7acabe9f43065280edf2dee91ae53f6472dcf02/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.h

Status: Fixed (was: Started)

Sign in to add a comment