New issue
Advanced search Search tips
Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Feature



Sign in to add a comment
link

Issue 915081: More ways to generate eager code cache in service worker

Reported by bashi@chromium.org, Dec 14 Project Member

Issue description

In  issue 768705  we added eager code cache support in service worker when adding scripts to cache storage. As of M72 we only generate eager code cache inside install events but we can think of different approaches to generate eager code cache. For example, we can generate code cache in idle tasks, or we can spawn a background thread to generate code cache.

This issue tracks efforts exploring more ways to generate code cache to improve overall service worker performance.

For more info about eager code cache, see original design docs:
- https://docs.google.com/document/d/1d8EeIY7nWpVT7yyofyqQuy57rQEf4Ft0s0virCSxUWI/edit
- https://docs.google.com/document/d/1dNKBiXi_aQTx6mMiHLLzuTZuWLsxTnejFK8GeLffCI4/edit
 

Comment 1 by bugdroid1@chromium.org, Dec 14

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/799f7fe8759c7d577aafcd15748169b283c70827

commit 799f7fe8759c7d577aafcd15748169b283c70827
Author: Kenichi Ishibashi <bashi@chromium.org>
Date: Fri Dec 14 06:04:46 2018

service worker: Remove a DCHECK from ServiceWorkerSubresourceLoader

Before this CL we had a DCHECK in OnFallback() to make sure
that the loader isn't the only one who has a reference to
|fallback_factory_|. The intent was to make sure that the
fallback factory lives long enough to handle the response,
but it turned out we wouldn't need to ensure that because
we don't need the request in that case.

Background context:
I hit this DCHECK while implementing PoC CL of generating
code cache in idle tasks.

Bug: 915081
Change-Id: Ia636edf31c6c1cf9b95ae0a3db9f913d578bd733
Reviewed-on: https://chromium-review.googlesource.com/c/1377487
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616596}
[modify] https://crrev.com/799f7fe8759c7d577aafcd15748169b283c70827/content/renderer/service_worker/service_worker_subresource_loader.cc

Comment 2 by bugdroid1@chromium.org, Dec 20

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

commit c18114e4c88b7e3dffd1e1533e3e9ad428359172
Author: Kenichi Ishibashi <bashi@chromium.org>
Date: Thu Dec 20 09:18:35 2018

service worker: Add a way to notify a service worker schedules idle tasks

We are going to add a mode to generate eager code cache in a idle task.
To avoid a service worker from being asked to terminate until the idle task
is finished, we need a way to let ServiceWorkerContextClient know there is
a task to be executed. This CL adds code to plumb such information.

This CL doesn't have behavioral changes. Follow-up CL implements an actual
idle task.

Bug: 915081
Change-Id: I93e89887f08c126746ba2ef0dcace115466ab66c
Reviewed-on: https://chromium-review.googlesource.com/c/1381358
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#618147}
[modify] https://crrev.com/c18114e4c88b7e3dffd1e1533e3e9ad428359172/content/renderer/service_worker/service_worker_context_client.cc
[modify] https://crrev.com/c18114e4c88b7e3dffd1e1533e3e9ad428359172/content/renderer/service_worker/service_worker_context_client.h
[modify] https://crrev.com/c18114e4c88b7e3dffd1e1533e3e9ad428359172/content/renderer/service_worker/service_worker_context_client_unittest.cc
[modify] https://crrev.com/c18114e4c88b7e3dffd1e1533e3e9ad428359172/third_party/blink/public/web/modules/service_worker/web_service_worker_context_client.h
[modify] https://crrev.com/c18114e4c88b7e3dffd1e1533e3e9ad428359172/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
[modify] https://crrev.com/c18114e4c88b7e3dffd1e1533e3e9ad428359172/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h
[modify] https://crrev.com/c18114e4c88b7e3dffd1e1533e3e9ad428359172/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.cc
[modify] https://crrev.com/c18114e4c88b7e3dffd1e1533e3e9ad428359172/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.h

Comment 3 by bugdroid1@chromium.org, Dec 26

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0265fa39acc423c4ca28b32f9408c88146b695e1

commit 0265fa39acc423c4ca28b32f9408c88146b695e1
Author: Kenichi Ishibashi <bashi@chromium.org>
Date: Wed Dec 26 03:24:19 2018

Use uint8_t for CachedMetadata

Historically Blink uses const char* for binary data but it doesn't fit
well with mojo IPCs. Convert const char* to uint8_t.

Bug: 915081
Change-Id: Ic0c0719d3eb3c3b72604ad6913a963c552da0dbc
Reviewed-on: https://chromium-review.googlesource.com/c/1390030
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#618899}
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/content/renderer/renderer_blink_platform_impl.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/content/renderer/renderer_blink_platform_impl.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/public/platform/platform.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/bindings/core/v8/script_streamer_test.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/core/loader/resource/script_resource.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/core/loader/resource/script_resource.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/core/loader/threadable_loader.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/core/loader/threadable_loader.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/core/workers/installed_scripts_manager.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/core/workers/installed_scripts_manager.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/core/workers/worker_classic_script_loader.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/core/workers/worker_global_scope.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/core/workers/worker_global_scope.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/core/workers/worker_thread.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/core/workers/worker_thread.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/modules/cache_storage/cache.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/modules/service_worker/service_worker_installed_scripts_manager.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/modules/service_worker/service_worker_script_cached_metadata_handler.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/modules/service_worker/service_worker_script_cached_metadata_handler.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/fetch/cached_metadata.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/fetch/cached_metadata.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/fetch/cached_metadata_handler.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/fetch/raw_resource.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/fetch/raw_resource.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/fetch/resource.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/fetch/resource.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/fetch/resource_fetcher_test.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/fetch/resource_loader.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/fetch/resource_test.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/fetch/script_cached_metadata_handler.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/fetch/source_keyed_cached_metadata_handler.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/fetch/source_keyed_cached_metadata_handler.h
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/fetch/source_keyed_cached_metadata_handler_test.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/testing/mock_resource.cc
[modify] https://crrev.com/0265fa39acc423c4ca28b32f9408c88146b695e1/third_party/blink/renderer/platform/loader/testing/mock_resource.h

Comment 4 by bugdroid, Feb 13 (4 days ago)

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/17164f24eed945f5f12abe344744e5b62dde9751

commit 17164f24eed945f5f12abe344744e5b62dde9751
Author: Kenichi Ishibashi <bashi@chromium.org>
Date: Wed Feb 13 02:43:57 2019

service worker: Add fieldtrial config for eager code cache outside install event

So that we can run the fieldtrial on Beta channel.

Bug: 915081
Change-Id: Id3187467f9ce69fa6d172913b38f4a1499eeb596
Reviewed-on: https://chromium-review.googlesource.com/c/1466210
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#631520}
[modify] https://crrev.com/17164f24eed945f5f12abe344744e5b62dde9751/testing/variations/fieldtrial_testing_config.json

Sign in to add a comment