Chromium Code Reviews| Index: content/common/shared_worker.mojom |
| diff --git a/content/common/shared_worker.mojom b/content/common/shared_worker.mojom |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0cdead692baccb4c8b34307ee36a6dbe8c403674 |
| --- /dev/null |
| +++ b/content/common/shared_worker.mojom |
| @@ -0,0 +1,77 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +module content.mojom; |
| + |
| +import "mojo/common/string16.mojom"; |
| +import "url/mojo/url.mojom"; |
| + |
| +[Native] |
| +enum WebContentSecurityPolicyType; |
|
shimazu
2017/01/05 02:24:03
You should also create a typemap file to use [Nati
nhiroki
2017/01/10 08:44:06
Thank you for the pointer. Done.
|
| + |
| +[Native] |
| +enum WebSharedWorkerCreationContextType; |
| + |
| +[Native] |
| +enum WebAddressSpace; |
| + |
| +[Native] |
| +enum WebWorkerCreationError; |
| + |
| +struct SharedWorker_CreateWorker_Params { |
| + // URL for the worker script. |
| + url.mojom.Url url; |
| + |
| + // Name for a SharedWorker, otherwise empty string. |
| + mojo.common.mojom.String16 name; |
| + |
| + // Security policy used in the worker. |
| + mojo.common.mojom.String16 content_security_policy; |
| + |
| + // Security policy type used in the worker. |
| + WebContentSecurityPolicyType security_policy_type; |
| + |
| + // The ID of the parent document (unique within parent renderer). |
| + uint64 document_id; |
| + |
| + // RenderFrame routing id used to send messages back to the parent. |
| + int32 render_frame_route_id; |
| + |
| + // Address space of the context that created the worker. |
| + WebAddressSpace creation_address_space; |
| + |
| + // The type (secure or nonsecure) of the context that created the worker. |
| + WebSharedWorkerCreationContextType creation_context_type; |
| +}; |
| + |
| +struct SharedWorker_CreateWorker_Reply { |
| + // The route id for the created worker. |
| + int32 route_id; |
| + |
| + // The error that occurred, if the browser failed to create the worker. |
| + WebWorkerCreationError error; |
| +}; |
| + |
| +// Per-process browser-side interface bound to SharedWorkerMessageFilter. |
| +// Each InterfacePtrs on the same render process will be bound to the same |
| +// SharedWorkerMessageFilter. |
| +interface SharedWorkerMessageFilter { |
| + // A renderer calls this to the browser process when it wants to create a |
| + // worker. The browser will create the worker process if necessary, and |
| + // will return the route id on in the reply on success. On error returns |
| + // MSG_ROUTING_NONE and an error type. |
|
kinuko
2017/01/05 08:13:13
Are we eventually deprecating route_id from the wo
kinuko
2017/01/05 08:13:13
This comment looks stale
nhiroki
2017/01/10 08:44:05
You're right. Added comments.
nhiroki
2017/01/10 08:44:06
Done.
|
| + [Sync] |
|
horo
2017/01/06 04:18:13
We don't need to throw a DOM exception for URLMism
nhiroki
2017/01/10 08:44:05
Good point. I'd like to work on it in a separate C
|
| + OnCreateWorker(SharedWorker_CreateWorker_Params params) |
| + => (SharedWorker_CreateWorker_Reply reply); |
|
kinuko
2017/01/05 08:13:14
We could probably just return route_id and error w
nhiroki
2017/01/10 08:44:06
Done.
|
| + |
| + // A renderer calls this to the browser process when a document has been |
| + // detached. The browser will use this to constrain the lifecycle of worker |
| + // processes (SharedWorkers are shut down when their last associated document |
|
kinuko
2017/01/05 08:13:14
'worker processes' -> 'the renderer process where
nhiroki
2017/01/10 08:44:05
Done.
|
| + // is detached). |
| + OnDocumentDetached(uint64 document_id); |
| + |
| + // A renderer sends this to the browser process when it wants to connect to a |
| + // worker. |
|
kinuko
2017/01/05 08:13:13
a worker -> the worker that is specified by route_
nhiroki
2017/01/10 08:44:06
Done.
|
| + OnConnectToWorker(int32 route_id, int32 sent_message_port_id); |
| +}; |