chromium/services/viz/public/mojom/compositing/compositor_frame_transition_directive.mojom

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

module viz.mojom;


import "services/viz/public/mojom/compositing/compositor_render_pass_id.mojom";
import "services/viz/public/mojom/compositing/view_transition_element_resource_id.mojom";
import "third_party/blink/public/mojom/tokens/tokens.mojom";
import "ui/gfx/mojom/display_color_spaces.mojom";

enum CompositorFrameTransitionDirectiveType {
  kSave,
  kAnimateRenderer,
  kRelease
};

// This struct identifes a shared element.
struct CompositorFrameTransitionDirectiveSharedElement {
  CompositorRenderPassId render_pass_id;
  ViewTransitionElementResourceId view_transition_element_resource_id;
};

// See components/viz/common/quads/compositor_frame_transition_directive.h
// for a description of this struct.
struct CompositorFrameTransitionDirective {
  // Uniquely identifies a transition sequence.
  //
  // For cross-document navigations, the token is generated by the browser
  // process. The ID is shared between CompositorFrameSinks rendering the two
  // Documents (which may be rendered in different processes) via the browser
  // process. Access to this ID ensures only the renderer processes hosting the
  // new Document can access content cached from the old Document.
  //
  // For same-document transitions (which may or may not be associated with a
  // same-document navigation), the token is generated by the renderer process
  // and only used by the CompositorFrameSink rendering that Document.
  blink.mojom.ViewTransitionToken transition_token;

  // Set for cross-document navigations where the transition caches content on a
  // CompositorFrameSink but the animation may run on a different
  // CompositorFrameSink.
  //
  // Passing the cached data between the 2 CompositorFrameSinks is mediated by
  // the FrameSinkManager. If set, the FrameSinkManagerClient is responsible for
  // ensuring the cached resources are cleaned up.
  bool maybe_cross_frame_sink;

  // A monotonically increasing sequence_id for a given communication channel
  // (i.e. surface). This is used to distinguish new directives from directives
  // that have already been processed.
  uint32 sequence_id;

  // The type of this directive.
  CompositorFrameTransitionDirectiveType type;

  // A collection of shared elements.
  array<CompositorFrameTransitionDirectiveSharedElement> shared_elements;

  // Display color spaces that the compositor expects are used for this
  // directive.
  gfx.mojom.DisplayColorSpaces display_color_spaces;
};