chromium/third_party/blink/public/mojom/worker/shared_worker_client.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/worker/shared_worker_creation_context_type.mojom";
import "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom";

// An interface used by clients (e.g., the renderer where "new SharedWorker()"
// was invoked) to observe events from a shared worker.
interface SharedWorkerClient {
  // Indicates that the shared worker process has started (or may have already
  // been started). The shared worker script is not necessarily loaded yet.
  // This event will be followed by either OnConnected or OnScriptLoadFailed.
  OnCreated(SharedWorkerCreationContextType creation_context_type);

  // Indicates that the shared worker process is up and running, script loaded.
  OnConnected(array<WebFeature> features_used);

  // Indicates that the shared worker script failed to load.
  // If |error_message| is not empty, it will be printed 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);
};