// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. module content.mojom; import "content/common/service_worker/service_worker_event_dispatcher.mojom"; import "content/common/service_worker/service_worker_installed_scripts_manager.mojom"; import "content/common/service_worker/service_worker_provider.mojom"; import "mojo/common/string16.mojom"; import "mojo/common/time.mojom"; import "services/service_manager/public/interfaces/interface_provider.mojom"; import "third_party/WebKit/public/web/console_message.mojom"; import "third_party/WebKit/public/web/worker_content_settings_proxy.mojom"; import "url/mojo/url.mojom"; [Native] struct EmbeddedWorkerStartParams; // Holds timing information about the start worker sequence for UMA. struct EmbeddedWorkerStartTiming { // When this Blink instance finished initializing. mojo.common.mojom.TimeTicks blink_initialized_time; // When the start worker message was received by the renderer. mojo.common.mojom.TimeTicks start_worker_received_time; }; // EmbeddedWorkerInstanceClient is the renderer-side ("Client") of // EmbeddedWorkerInstanceHost. It allows control of a renderer-side // embedded worker. The browser uses this interface to start, stop, and // issue commands to the worker. interface EmbeddedWorkerInstanceClient { // Called back as various functions in EmbeddedWorkerInstanceHost, such // as OnThreadStarted(), OnStarted(). StartWorker(EmbeddedWorkerStartParams params, ServiceWorkerEventDispatcher& dispatcher_request, ServiceWorkerInstalledScriptsInfo? installed_scripts_info, associated EmbeddedWorkerInstanceHost instance_host, ServiceWorkerProviderInfoForStartWorker provider_info, blink.mojom.WorkerContentSettingsProxy content_settings_proxy); // The response is sent back via EmbeddedWorkerInstanceHost.OnStopped(). StopWorker(); ResumeAfterDownload(); AddMessageToConsole(blink.mojom.ConsoleMessageLevel level, string message); }; // EmbeddedWorkerInstanceHost is the browser-side ("Host") of // EmbeddedWorkerInstanceClient. It allows control of 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 { // Indicates that the worker is ready for inspection. OnReadyForInspection(); // Indicates that the worker has finished loading the script. OnScriptLoaded(); // Indicates that the worker has failed to load the script. OnScriptLoadFailed(); // Indicates that the worker thread has started. |thread_id| is the actual // platform thread id on which the worker runs. // This is called after OnScriptLoaded. OnThreadStarted(int32 thread_id); // Indicates that the worker has evaluated the script. |success| means // evaluating the script completed and no uncaught exception occurred. // This is called after OnThreadStarted. OnScriptEvaluated(bool success); // Indicates that the worker has started. // This is called after OnScriptEvaluated. OnStarted(EmbeddedWorkerStartTiming start_timing); // Reports that an uncaught exception occurred in the worker. OnReportException(mojo.common.mojom.String16 error_message, int32 line_number, int32 column_number, url.mojom.Url source_url); // Reports that a console message was emitted to the worker's console. OnReportConsoleMessage(int32 source_identifier, int32 message_level, mojo.common.mojom.String16 message, int32 line_number, url.mojom.Url source_url); // Indicates that the worker has stopped. OnStopped(); };