Commit c092e144 authored by Matt Falkenhagen's avatar Matt Falkenhagen Committed by Commit Bot

service worker: Add documentation about where Mojo interfaces live.

Bug: 795989
Change-Id: Ieb5267a87b43f14a6ae3f3bc29b14402afd2e3ab
Reviewed-on: https://chromium-review.googlesource.com/1166277
Commit-Queue: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584376}
parent f40d6208
...@@ -88,6 +88,9 @@ struct EmbeddedWorkerStartTiming { ...@@ -88,6 +88,9 @@ struct EmbeddedWorkerStartTiming {
// EmbeddedWorkerInstanceHost. It allows control of a renderer-side // EmbeddedWorkerInstanceHost. It allows control of a renderer-side
// embedded worker. The browser uses this interface to start, stop, and // embedded worker. The browser uses this interface to start, stop, and
// issue commands to the worker. // issue commands to the worker.
//
// This interface is the master interface of a dedicated message pipe. It has
// some interfaces associated with it, like EmbeddedWorkerInstanceHost.
interface EmbeddedWorkerInstanceClient { interface EmbeddedWorkerInstanceClient {
// Called back as various functions in EmbeddedWorkerInstanceHost, such // Called back as various functions in EmbeddedWorkerInstanceHost, such
// as OnThreadStarted(), OnStarted(). // as OnThreadStarted(), OnStarted().
...@@ -102,11 +105,12 @@ interface EmbeddedWorkerInstanceClient { ...@@ -102,11 +105,12 @@ interface EmbeddedWorkerInstanceClient {
}; };
// EmbeddedWorkerInstanceHost is the browser-side ("Host") of // EmbeddedWorkerInstanceHost is the browser-side ("Host") of
// EmbeddedWorkerInstanceClient. It allows control of a browser-side // EmbeddedWorkerInstanceClient. It allows control of a browser-side embedded
// embedded worker instance. The renderer uses this interface to report // worker instance. The renderer uses this interface to report embedded worker
// embedded worker state back to the browser, or request termination of the // state back to the browser, or request termination of the worker. This
// worker. This interface is associated with the EmbeddedWorkerInstanceClient // interface is associated with the master interface
// interface. // EmbeddedWorkerInstanceClient, so it lives on the same message pipe as
// EmbeddedWorkerInstanceClient.
interface EmbeddedWorkerInstanceHost { interface EmbeddedWorkerInstanceHost {
// S13nServiceWorker: // S13nServiceWorker:
// Called when the worker requests to be terminated. The worker will request // Called when the worker requests to be terminated. The worker will request
......
...@@ -19,9 +19,25 @@ enum ControllerServiceWorkerPurpose { ...@@ -19,9 +19,25 @@ enum ControllerServiceWorkerPurpose {
FETCH_SUB_RESOURCE FETCH_SUB_RESOURCE
}; };
// mojom::ServiceWorkerContainerHost is a browser-side interface. The renderer // ServiceWorkerContainerHost is an interface implemented by the browser
// process uses this interface to request the browser process to do operations // process. The renderer process uses this interface to request the browser
// involving service worker registrations. // process to do operations involving service worker registrations.
//
// This interface is associated with its counterpart ServiceWorkerContainer.
// The message pipe it's used on depends on the container type.
// - For service workers:
// Associated with EmbeddedWorkerInstanceClient, which is on a dedicated
// message pipe.
// - For shared workers (S13nSW):
// Associated with SharedWorkerFactory, which is on a dedicated message
// pipe.
// - For shared workers (non-S13nSW):
// Associated with ServiceWorkerDispatcherHost, which is on the
// channel-associated interface to the renderer process.
// IPC channel.
// - For documents:
// Associated with ServiceWorkerDispatcherHost, which is on the
// channel-associated interface to the renderer process.
interface ServiceWorkerContainerHost { interface ServiceWorkerContainerHost {
// Corresponds to navigator.serviceWorker.register(). // Corresponds to navigator.serviceWorker.register().
// Registers a service worker from |script_url| with |options|. // Registers a service worker from |script_url| with |options|.
...@@ -93,9 +109,9 @@ interface ServiceWorkerContainerHost { ...@@ -93,9 +109,9 @@ interface ServiceWorkerContainerHost {
HintToUpdateServiceWorker(); HintToUpdateServiceWorker();
}; };
// mojom::ServiceWorkerContainer is a renderer-side interface. // ServiceWorkerContainer is an interface implemented by the renderer process.
// The browser process uses this interface to send messages to documents or // The browser process uses this interface to send messages to documents or the
// the service worker. // service worker.
// //
// Roughly corresponds to the web-exposed ServiceWorkerContainer interface, // Roughly corresponds to the web-exposed ServiceWorkerContainer interface,
// i.e., navigator.serviceWorker. Actually, the plan is for this interface to be // i.e., navigator.serviceWorker. Actually, the plan is for this interface to be
...@@ -105,6 +121,11 @@ interface ServiceWorkerContainerHost { ...@@ -105,6 +121,11 @@ interface ServiceWorkerContainerHost {
// implement navigator.serviceWorker for Worker yet. But eventually anything // implement navigator.serviceWorker for Worker yet. But eventually anything
// that can touch these objects should be a ServiceWorkerContainer, so it’s OK // that can touch these objects should be a ServiceWorkerContainer, so it’s OK
// to use this name. // to use this name.
//
// This interface is associated with its counterpart,
// ServiceWorkerContainerHost, as they are sent on the same master interface
// together. See ServiceWorkerContainerHost for documentation about the message
// pipe they live on.
interface ServiceWorkerContainer { interface ServiceWorkerContainer {
// Corresponds to setting ServiceWorkerContainer#controller. // Corresponds to setting ServiceWorkerContainer#controller.
// If |controller_info| is invalid (its |object_info| is null), then // If |controller_info| is invalid (its |object_info| is null), then
......
...@@ -95,13 +95,9 @@ struct ServiceWorkerProviderHostInfo { ...@@ -95,13 +95,9 @@ struct ServiceWorkerProviderHostInfo {
}; };
// ServiceWorkerWorkerClient represents a service worker client that is a worker // ServiceWorkerWorkerClient represents a service worker client that is a worker
// (i.e., a shared worker or dedicated worker). We use this interface to let the // (i.e., a shared worker or dedicated worker). The main thread of
// WebWorkerFetchContextImpl in the worker thread know about the change of // the renderer process uses this interface to tell the worker thread
// controlling service worker by calling OnControllerChanged() from the // when the controller service worker changes.
// ServiceWorkerProviderContext in the main thread of the renderer process.
//
// TODO(horo): We should implement ServiceWorkerProvider in the worker thread
// instead of using this interface to support WorkerNavigator.serviceWorker.
interface ServiceWorkerWorkerClient { interface ServiceWorkerWorkerClient {
// Called when the worker is controlled by a new service worker. This is only // Called when the worker is controlled by a new service worker. This is only
// used to let the worker know that we now have a service worker (while there // used to let the worker know that we now have a service worker (while there
...@@ -124,9 +120,12 @@ interface ServiceWorkerWorkerClientRegistry { ...@@ -124,9 +120,12 @@ interface ServiceWorkerWorkerClientRegistry {
CloneWorkerClientRegistry(ServiceWorkerWorkerClientRegistry& host); CloneWorkerClientRegistry(ServiceWorkerWorkerClientRegistry& host);
}; };
// Per-process browser-side interface. // An interface implemented by the browser process, with one implementation per
// The renderer uses this interface to tell the browser when potential service // renderer process. The renderer uses this interface to tell the browser when
// worker clients are created and when service workers are starting up. // potential service worker clients are created.
//
// This interface is on the channel-associated interface to the renderer
// process.
interface ServiceWorkerDispatcherHost { interface ServiceWorkerDispatcherHost {
// Creates a content::ServiceWorkerProviderHost on the browser // Creates a content::ServiceWorkerProviderHost on the browser
// process. |provider_info| has Mojo endpoints to connect the container host // process. |provider_info| has Mojo endpoints to connect the container host
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment