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 "mojo/common/string16.mojom"; |
8 import "services/service_manager/public/interfaces/interface_provider.mojom"; | 9 import "services/service_manager/public/interfaces/interface_provider.mojom"; |
9 import "third_party/WebKit/public/web/console_message.mojom"; | 10 import "third_party/WebKit/public/web/console_message.mojom"; |
10 import "url/mojo/url.mojom"; | 11 import "url/mojo/url.mojom"; |
11 | 12 |
12 [Native] | 13 [Native] |
13 struct EmbeddedWorkerStartParams; | 14 struct EmbeddedWorkerStartParams; |
14 | 15 |
15 // Interface to control a renderer-side worker's environment. | 16 // Interface to control a renderer-side embedded worker. The browser uses this |
| 17 // interface to start, stop, and issue commands to the worker. |
16 interface EmbeddedWorkerInstanceClient { | 18 interface EmbeddedWorkerInstanceClient { |
17 StartWorker(EmbeddedWorkerStartParams params, | 19 StartWorker(EmbeddedWorkerStartParams params, |
18 ServiceWorkerEventDispatcher& dispatcher_request); | 20 ServiceWorkerEventDispatcher& dispatcher_request, |
19 StopWorker() => (); | 21 associated EmbeddedWorkerInstanceHost instance_host); |
| 22 // The response is sent back via EmbeddedWorkerInstanceHost.OnStopped(). |
| 23 StopWorker(); |
20 ResumeAfterDownload(); | 24 ResumeAfterDownload(); |
21 AddMessageToConsole(blink.mojom.ConsoleMessageLevel level, | 25 AddMessageToConsole(blink.mojom.ConsoleMessageLevel level, |
22 string message); | 26 string message); |
23 }; | 27 }; |
| 28 |
| 29 // Interface to control a browser-side embedded worker instance. The renderer |
| 30 // uses this interface to report embedded worker state back to the browser. |
| 31 // This interface is associated with the EmbeddedWorkerInstanceClient interface. |
| 32 interface EmbeddedWorkerInstanceHost { |
| 33 // Indicates that the worker is ready for inspection. |
| 34 OnReadyForInspection(); |
| 35 // Indicates that the worker has finished loading the script. |
| 36 OnScriptLoaded(); |
| 37 // Indicates that the worker has failed to load the script. |
| 38 OnScriptLoadFailed(); |
| 39 // Indicates that the worker thread has started. |thread_id| is the actual |
| 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. |
| 44 // This is called after OnScriptLoaded. |
| 45 OnThreadStarted(int32 thread_id, int32 provider_id); |
| 46 // Indicates that the worker has evaluated the script. |success| means |
| 47 // evaluating the script completed and no uncaught exception occurred. |
| 48 // This is called after OnThreadStarted. |
| 49 OnScriptEvaluated(bool success); |
| 50 // Indicates that the worker has started. |
| 51 // This is called after OnScriptEvaluated. |
| 52 OnStarted(); |
| 53 // Reports that an uncaught exception occurred in the worker. |
| 54 OnReportException(mojo.common.mojom.String16 error_message, int32 line_number, |
| 55 int32 column_number, url.mojom.Url source_url); |
| 56 // Reports that a console message was emitted to the worker's console. |
| 57 OnReportConsoleMessage(int32 source_identifier, int32 message_level, |
| 58 mojo.common.mojom.String16 message, int32 line_number, |
| 59 url.mojom.Url source_url); |
| 60 // Indicates that the worker has stopped. |
| 61 OnStopped(); |
| 62 }; |
OLD | NEW |