Use Mojo IPC to connect to shared workers

Desktop / Chromium - Darin Fisher [chromium.org] - 8 September 2017 20:48 EDT

This updates the client side of shared worker IPC infrastructure to use Mojo. In a subsequent patch, it could make sense to move the client side code entirely into Blink.

As a minor change, the "OnConnected" event takes the creation context type so that the creation error can be computed on the client side. This avoids having to define the enum type for the creation error.

Various enums are introduced as corresponding mojom types w/ typemaps. In a subsequent patch, it may make sense to eliminate the native types in favor of the mojom defined types.

WorkerDocumentSet is no longer needed and the notion of DocumentID on the browser-side is eliminated in favor of the browser-side monitoring the lifetime of the clients (via mojo connection error).

SharedWorkerMessageFilter is now only used for IPC to the shared worker instance rather than being dual purpose for both the shared worker instance and the clients. This simplifies some of the logic in the browser-side, but also adds some complexity as the shared worker service now needs SharedWorkerMessageFilters, which are created for each renderer process, to be registered on the service.

For now, browser-side infrastructure all remains on the IO thread, but once the IPC to the shared worker instance is moved to Mojo, it'll be straightforward to move all of the browser-side infrastructure off the IO thread. That will simplify the browser-side code as it will no longer need the thread hops.

Bug: 612308 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation Change-Id: I8f065cec16673061104817b1c4b41d55e2d12203 Reviewed-on: https://chromium-review.googlesource.com/642112 Commit-Queue: Darin Fisher

7d01ede Use Mojo IPC to connect to shared workers
content/browser/BUILD.gn | 4 +-
.../shared_worker_devtools_manager_unittest.cc | 10 +-
.../browser/frame_host/render_frame_host_impl.cc | 14 +-
.../renderer_host/render_process_host_impl.cc | 14 +-
content/browser/shared_worker/DEPS | 2 +
.../shared_worker/shared_worker_connector_impl.cc | 82 ++++
.../shared_worker/shared_worker_connector_impl.h | 53 +++
.../browser/shared_worker/shared_worker_host.cc | 152 +++---
content/browser/shared_worker/shared_worker_host.h | 83 ++--
.../shared_worker/shared_worker_instance.cc | 2 +-
.../browser/shared_worker/shared_worker_instance.h | 8 +-
.../shared_worker_instance_unittest.cc | 6 +-
.../shared_worker/shared_worker_message_filter.cc | 45 +-
.../shared_worker/shared_worker_message_filter.h | 23 +-
.../shared_worker/shared_worker_service_impl.cc | 198 ++++----
.../shared_worker/shared_worker_service_impl.h | 40 +-
.../shared_worker_service_impl_unittest.cc | 521 +++++++++++----------
.../browser/shared_worker/worker_document_set.cc | 92 ----
.../browser/shared_worker/worker_document_set.h | 99 ----
content/common/BUILD.gn | 2 +
content/common/content_param_traits_macros.h | 3 -
content/common/shared_worker/OWNERS | 2 +
.../shared_worker/shared_worker_client.mojom | 27 ++
.../shared_worker/shared_worker_connector.mojom | 31 ++
content/common/swapped_out_messages.cc | 2 -
content/common/view_messages.h | 63 ---
content/common/worker_messages.h | 13 -
.../public/app/mojo/content_browser_manifest.json | 1 +
content/renderer/BUILD.gn | 4 +-
content/renderer/render_frame_impl.cc | 4 +-
content/renderer/render_view_impl.cc | 1 -
.../shared_worker/shared_worker_client_impl.cc | 41 ++
.../shared_worker/shared_worker_client_impl.h | 37 ++
.../shared_worker/shared_worker_repository.cc | 69 +--
.../shared_worker/shared_worker_repository.h | 33 +-
.../shared_worker/websharedworker_proxy.cc | 90 ----
.../renderer/shared_worker/websharedworker_proxy.h | 69 ---
.../exported/SharedWorkerRepositoryClientImpl.cpp | 41 +-
third_party/WebKit/public/BUILD.gn | 5 +-
.../public/platform/AddressSpaceStructTraits.h | 49 ++
.../platform/ContentSecurityPolicyStructTraits.h | 46 ++
.../WebKit/public/platform/WebAddressSpace.h | 5 +-
third_party/WebKit/public/platform/WebURLRequest.h | 1 -
.../WebKit/public/platform/address_space.mojom | 17 +
.../WebKit/public/platform/address_space.typemap | 9 +
.../public/platform/content_security_policy.mojom | 12 +
.../platform/content_security_policy.typemap | 9 +
third_party/WebKit/public/public_typemaps.gni | 2 +
.../public/web/WebSharedWorkerConnectListener.h | 7 +-
.../web/WebSharedWorkerCreationContextType.h | 25 -
.../public/web/WebSharedWorkerCreationErrors.h | 21 -
.../public/web/WebSharedWorkerRepositoryClient.h | 7 +-
.../web/shared_worker_creation_context_type.mojom | 10 +
53 files changed, 1038 insertions(+), 1168 deletions(-)

Upstream: git.chromium.org


  • Share