chromium/third_party/blink/public/mojom/worker/shared_worker_host.mojom

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module blink.mojom;

import "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom";
import "third_party/blink/public/mojom/devtools/devtools_agent.mojom";

// Each shared worker has a corresponding host. The host controls the lifetime
// of the shared worker. This interface is used by the shared worker to talk to
// its host.
interface SharedWorkerHost {
  // Called in response to SharedWorker's Connect method. The |connection_id|
  // parameter is the same value passed to the Connect method.
  OnConnected(int32 connection_id);

  // Indicates that the shared worker self-closed. This should trigger the host
  // to terminate the shared worker.
  OnContextClosed();

  // Indicates that the shared worker is ready for inspection,
  // passes a DevToolsAgent interface for this worker and requests
  // a corresponding host. See DevToolsAgent for details.
  OnReadyForInspection(pending_remote<blink.mojom.DevToolsAgent> agent,
                       pending_receiver<blink.mojom.DevToolsAgentHost> agent_host);

  // Indicates that the script failed to load.
  // If |error_message| is not empty, it will be ptinted in the creator frame's
  // console.
  OnScriptLoadFailed(string error_message);

  // Indicates that the shared worker used a feature. This is intended to be
  // logged by the client-side feature logging infrastructure.
  OnFeatureUsed(WebFeature feature);
};