chromium/services/tracing/public/mojom/tracing_service.mojom

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

module tracing.mojom;

[EnableIf=is_perfetto_supported_os]
import "services/tracing/public/mojom/perfetto_service.mojom";

import "sandbox/policy/mojom/context.mojom";
import "sandbox/policy/mojom/sandbox.mojom";
import "services/tracing/public/mojom/traced_process.mojom";

// Represents a single client process to be traced.
struct ClientInfo {
  // The system PID of the process.
  int32 pid;

  // The interface used to control tracing in the process.
  pending_remote<TracedProcess> process;
};

[EnableIf=is_linux_or_chromeos]
const sandbox.mojom.Sandbox kTracingSandbox = sandbox.mojom.Sandbox.kUtility;
[EnableIfNot=is_linux_or_chromeos]
const sandbox.mojom.Sandbox kTracingSandbox = sandbox.mojom.Sandbox.kService;

// The main interface to the Tracing service. This is only consumed by
// privileged clients (e.g. browser process).
[ServiceSandbox=kTracingSandbox,RequireContext=sandbox.mojom.Context.kBrowser]
interface TracingService {
  // Initializes the service with the current known set of running processes.
  Initialize(array<ClientInfo> clients);

  // Adds a client process to be traced.
  AddClient(ClientInfo client);

  // Binds a ConsumerHost interface to control the state of tracing across the
  // system.
  [EnableIf=is_perfetto_supported_os]
  BindConsumerHost(pending_receiver<ConsumerHost> receiver);
};