DescriptionWorker: 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}
Committed: https://chromium.googlesource.com/chromium/src/+/c7acabe9f43065280edf2dee91ae53f6472dcf02
Patch Set 1 #Patch Set 2 : wip #Messages
Total messages: 18 (14 generated)
|