chromium/chrome/common/media/webrtc_logging.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 chrome.mojom;

import "mojo/public/mojom/base/time.mojom";

// Represents a log message sent from the agent.
struct WebRtcLoggingMessage {
  mojo_base.mojom.Time timestamp;
  string data;
};

// Used to listen for new log messages and events from the agent.
interface WebRtcLoggingClient {
  // New log messages are sent in batches to limit the frequency of calls.
  //
  // TODO(crbug.com/40727469): Investigate whether the [UnlimitedSize] tag can
  // be removed here by either chunking the messages into multiple calls or
  // using something like BigString for WebRtcLoggingMessage's data.
  [UnlimitedSize]
  OnAddMessages(array<WebRtcLoggingMessage> messages);

  // Called in response to |Stop| being called on the agent. Any pending
  // log messages will be sent via |OnAddMessages| first.
  OnStopped();
};

// Used to control the renderer-side agent to start / stop logging.
interface WebRtcLoggingAgent {
  // Enables logging to the given |client|.
  Start(pending_remote<WebRtcLoggingClient> client);

  // Stops logging, resulting in any pending messages being sent via
  // |OnAddMessages| and then |OnStopped| being called on the client.
  Stop();
};