OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 module content.mojom; | 5 module content.mojom; |
6 | 6 |
7 import "content/common/service_worker/service_worker_event_dispatcher.mojom"; | 7 import "content/common/service_worker/service_worker_event_dispatcher.mojom"; |
8 import "content/common/service_worker/service_worker_provider.mojom"; | |
9 import "mojo/common/string16.mojom"; | 8 import "mojo/common/string16.mojom"; |
10 import "services/service_manager/public/interfaces/interface_provider.mojom"; | 9 import "services/service_manager/public/interfaces/interface_provider.mojom"; |
11 import "third_party/WebKit/public/web/console_message.mojom"; | 10 import "third_party/WebKit/public/web/console_message.mojom"; |
12 import "url/mojo/url.mojom"; | 11 import "url/mojo/url.mojom"; |
13 | 12 |
14 [Native] | 13 [Native] |
15 struct EmbeddedWorkerStartParams; | 14 struct EmbeddedWorkerStartParams; |
16 | 15 |
17 // Interface to control a renderer-side embedded worker. The browser uses this | 16 // Interface to control a renderer-side embedded worker. The browser uses this |
18 // interface to start, stop, and issue commands to the worker. | 17 // interface to start, stop, and issue commands to the worker. |
19 interface EmbeddedWorkerInstanceClient { | 18 interface EmbeddedWorkerInstanceClient { |
20 StartWorker(EmbeddedWorkerStartParams params, | 19 StartWorker(EmbeddedWorkerStartParams params, |
21 ServiceWorkerEventDispatcher& dispatcher_request, | 20 ServiceWorkerEventDispatcher& dispatcher_request, |
22 associated EmbeddedWorkerInstanceHost instance_host, | 21 associated EmbeddedWorkerInstanceHost instance_host); |
23 ServiceWorkerProviderInfoForStartWorker provider_info); | |
24 // The response is sent back via EmbeddedWorkerInstanceHost.OnStopped(). | 22 // The response is sent back via EmbeddedWorkerInstanceHost.OnStopped(). |
25 StopWorker(); | 23 StopWorker(); |
26 ResumeAfterDownload(); | 24 ResumeAfterDownload(); |
27 AddMessageToConsole(blink.mojom.ConsoleMessageLevel level, | 25 AddMessageToConsole(blink.mojom.ConsoleMessageLevel level, |
28 string message); | 26 string message); |
29 }; | 27 }; |
30 | 28 |
31 // Interface to control a browser-side embedded worker instance. The renderer | 29 // Interface to control a browser-side embedded worker instance. The renderer |
32 // uses this interface to report embedded worker state back to the browser. | 30 // uses this interface to report embedded worker state back to the browser. |
33 // This interface is associated with the EmbeddedWorkerInstanceClient interface. | 31 // This interface is associated with the EmbeddedWorkerInstanceClient interface. |
34 interface EmbeddedWorkerInstanceHost { | 32 interface EmbeddedWorkerInstanceHost { |
35 // Indicates that the worker is ready for inspection. | 33 // Indicates that the worker is ready for inspection. |
36 OnReadyForInspection(); | 34 OnReadyForInspection(); |
37 // Indicates that the worker has finished loading the script. | 35 // Indicates that the worker has finished loading the script. |
38 OnScriptLoaded(); | 36 OnScriptLoaded(); |
39 // Indicates that the worker has failed to load the script. | 37 // Indicates that the worker has failed to load the script. |
40 OnScriptLoadFailed(); | 38 OnScriptLoadFailed(); |
41 // Indicates that the worker thread has started. |thread_id| is the actual | 39 // Indicates that the worker thread has started. |thread_id| is the actual |
42 // platform thread id on which the worker runs. | 40 // platform thread id on which the worker runs, while |provider_id| is the id |
| 41 // of the ServiceWorkerNetworkProvider instance, which is unique in one |
| 42 // renderer process, and the browser process uses this id to maintain a |
| 43 // counterpart ServiceWorkerProviderHost instance. |
43 // This is called after OnScriptLoaded. | 44 // This is called after OnScriptLoaded. |
44 OnThreadStarted(int32 thread_id); | 45 OnThreadStarted(int32 thread_id, int32 provider_id); |
45 // Indicates that the worker has evaluated the script. |success| means | 46 // Indicates that the worker has evaluated the script. |success| means |
46 // evaluating the script completed and no uncaught exception occurred. | 47 // evaluating the script completed and no uncaught exception occurred. |
47 // This is called after OnThreadStarted. | 48 // This is called after OnThreadStarted. |
48 OnScriptEvaluated(bool success); | 49 OnScriptEvaluated(bool success); |
49 // Indicates that the worker has started. | 50 // Indicates that the worker has started. |
50 // This is called after OnScriptEvaluated. | 51 // This is called after OnScriptEvaluated. |
51 OnStarted(); | 52 OnStarted(); |
52 // Reports that an uncaught exception occurred in the worker. | 53 // Reports that an uncaught exception occurred in the worker. |
53 OnReportException(mojo.common.mojom.String16 error_message, int32 line_number, | 54 OnReportException(mojo.common.mojom.String16 error_message, int32 line_number, |
54 int32 column_number, url.mojom.Url source_url); | 55 int32 column_number, url.mojom.Url source_url); |
55 // Reports that a console message was emitted to the worker's console. | 56 // Reports that a console message was emitted to the worker's console. |
56 OnReportConsoleMessage(int32 source_identifier, int32 message_level, | 57 OnReportConsoleMessage(int32 source_identifier, int32 message_level, |
57 mojo.common.mojom.String16 message, int32 line_number, | 58 mojo.common.mojom.String16 message, int32 line_number, |
58 url.mojom.Url source_url); | 59 url.mojom.Url source_url); |
59 // Indicates that the worker has stopped. | 60 // Indicates that the worker has stopped. |
60 OnStopped(); | 61 OnStopped(); |
61 }; | 62 }; |
OLD | NEW |