Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Unified Diff: content/common/service_worker/embedded_worker.mojom

Issue 2787883003: [ServiceWorker] Add EmbeddedWorkerInstanceHost Interface. (Closed)
Patch Set: Address comments from falken@ Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/service_worker/embedded_worker.mojom
diff --git a/content/common/service_worker/embedded_worker.mojom b/content/common/service_worker/embedded_worker.mojom
index ad40ca1de37035fe6be8d1c62e82aedd97c7372d..fe39a6c7b0321743e9940bb78d664cd30fd05f63 100644
--- a/content/common/service_worker/embedded_worker.mojom
+++ b/content/common/service_worker/embedded_worker.mojom
@@ -5,6 +5,7 @@
module content.mojom;
import "content/common/service_worker/service_worker_event_dispatcher.mojom";
+import "mojo/common/string16.mojom";
import "services/service_manager/public/interfaces/interface_provider.mojom";
import "third_party/WebKit/public/web/console_message.mojom";
import "url/mojo/url.mojom";
@@ -12,12 +13,50 @@ import "url/mojo/url.mojom";
[Native]
struct EmbeddedWorkerStartParams;
-// Interface to control a renderer-side worker's environment.
+// Interface to control a renderer-side embedded worker. The browser uses this
+// interface to start, stop, and issue commands to the worker.
interface EmbeddedWorkerInstanceClient {
StartWorker(EmbeddedWorkerStartParams params,
- ServiceWorkerEventDispatcher& dispatcher_request);
- StopWorker() => ();
+ ServiceWorkerEventDispatcher& dispatcher_request,
+ associated EmbeddedWorkerInstanceHost instance_host);
+ // The response is sent back via EmbeddedWorkerInstanceHost.OnStopped().
+ StopWorker();
ResumeAfterDownload();
AddMessageToConsole(blink.mojom.ConsoleMessageLevel level,
string message);
-};
+};
+
+// Interface to control a browser-side embedded worker instance. The renderer
+// uses this interface to report embedded worker state back to the browser.
+// This interface is associated with the EmbeddedWorkerInstanceClient interface.
+interface EmbeddedWorkerInstanceHost {
+ // Sent on main thread.
falken 2017/04/11 14:27:36 I'm curious why it's important to document sent on
leonhsl(Using Gerrit) 2017/04/12 03:34:04 Acknowledged.
leonhsl(Using Gerrit) 2017/04/12 12:32:12 Yes 'sent on xxx thread' is just describing the cu
+ // Indicates that the worker is ready for inspection.
+ OnReadyForInspection();
+ // Indicates that the worker has loaded the script.
+ OnScriptLoaded();
+ // Indicates that the worker has failed to load the script.
+ OnScriptLoadFailed();
+ // Indicates that the worker is stopped.
falken 2017/04/11 14:27:36 nit: just "that the worker stopped"
leonhsl(Using Gerrit) 2017/04/12 03:34:04 Acknowledged.
leonhsl(Using Gerrit) 2017/04/12 12:32:12 Done.
+ OnStopped();
+
+ // Sent on worker thread.
+ // Indicates that the worker thread is started. |thread_id| is the actual
+ // platform thread id on which the worker runs, while |provider_id| is the id
+ // of each ServiceWorkerNetworkProvider instance, which is unique in one
+ // renderer process, and the browser process uses this id to maintain a
+ // counterpart ServiceWorkerProviderHost instance.
+ OnThreadStarted(int32 thread_id, int32 provider_id);
+ // Indicates that the worker has evaluated the script. |success| means
+ // evaluating the script completed and no uncaught exception occurred.
+ OnScriptEvaluated(bool success);
+ // Indicates that the worker is started.
falken 2017/04/11 14:27:36 nit: just "that the worker started"
leonhsl(Using Gerrit) 2017/04/12 03:34:04 Acknowledged.
leonhsl(Using Gerrit) 2017/04/12 12:32:12 Done.
+ OnStarted();
+ // Reports an exception.
+ OnReportException(mojo.common.mojom.String16 error_message, int32 line_number,
+ int32 column_number, url.mojom.Url source_url);
+ // Reports console message.
+ OnReportConsoleMessage(int32 source_identifier, int32 message_level,
+ mojo.common.mojom.String16 message, int32 line_number,
+ url.mojom.Url source_url);
+};

Powered by Google App Engine
This is Rietveld 408576698