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