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

// Copyright 2023 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 "mojo/public/mojom/base/unguessable_token.mojom";
import "third_party/blink/public/mojom/devtools/devtools_agent.mojom";
import "third_party/blink/public/mojom/loader/code_cache.mojom";
import "third_party/blink/public/mojom/origin_trial_feature/origin_trial_feature.mojom";
import "url/mojom/origin.mojom";
import "url/mojom/url.mojom";

// Interface implemented in the browser for the worklets to forward
// ready-for-inspection notification.
interface WorkletDevToolsHost {
  // Indicates that the worklet is ready for inspection, passes a DevToolsAgent
  // interface for this worklet and requests a corresponding host.
  OnReadyForInspection(
    pending_remote<blink.mojom.DevToolsAgent> agent,
    pending_receiver<blink.mojom.DevToolsAgentHost> agent_host);
};

// Parameters for initializing WorkerOrWorkletGlobalScope. This is suitable for
// worklets starting from a different process.
struct WorkletGlobalScopeCreationParams {
  url.mojom.Url script_url;

  // The worklet's owning document's origin.
  url.mojom.Origin starter_origin;

  array<OriginTrialFeature> origin_trial_features;
  mojo_base.mojom.UnguessableToken devtools_token;
  pending_remote<WorkletDevToolsHost> devtools_host;
  pending_remote<CodeCacheHost> code_cache_host;
  bool wait_for_debugger;
};