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 each ServiceWorkerNetworkProvider instance, which is unique in one | |
falken
2017/04/12 14:30:18
nit: s/each/the
leonhsl(Using Gerrit)
2017/04/13 03:10:49
Done.
| |
42 // renderer process, and the browser process uses this id to maintain a | |
43 // counterpart ServiceWorkerProviderHost instance. | |
falken
2017/04/12 14:30:18
This is called after OnScriptLoaded.
leonhsl(Using Gerrit)
2017/04/13 03:10:49
Done.
| |
44 OnThreadStarted(int32 thread_id, int32 provider_id); | |
45 // Indicates that the worker has evaluated the script. |success| means | |
46 // evaluating the script completed and no uncaught exception occurred. | |
47 // This is always before OnStarted. | |
falken
2017/04/12 14:30:18
This is called after OnThreadStarted.
leonhsl(Using Gerrit)
2017/04/13 03:10:49
Done.
| |
48 OnScriptEvaluated(bool success); | |
49 // Indicates that the worker has started. | |
50 // This is always after OnScriptEvaluated. | |
falken
2017/04/12 14:30:18
This is called after OnScriptEvaluated.
leonhsl(Using Gerrit)
2017/04/13 03:10:49
Done.
| |
51 OnStarted(); | |
52 // Reports an exception. | |
falken
2017/04/12 14:30:18
Reports that an uncaught exception occurred in the
leonhsl(Using Gerrit)
2017/04/13 03:10:49
Done.
| |
53 OnReportException(mojo.common.mojom.String16 error_message, int32 line_number, | |
54 int32 column_number, url.mojom.Url source_url); | |
55 // Reports console message. | |
falken
2017/04/12 14:30:18
Reports that a console message was emitted to the
leonhsl(Using Gerrit)
2017/04/13 03:10:49
Done.
| |
56 OnReportConsoleMessage(int32 source_identifier, int32 message_level, | |
57 mojo.common.mojom.String16 message, int32 line_number, | |
58 url.mojom.Url source_url); | |
59 // Indicates that the worker has stopped. | |
60 OnStopped(); | |
61 }; | |
OLD | NEW |