// Copyright 2016 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 "services/viz/public/mojom/compositing/compositor_frame_sink.mojom";
import "services/viz/public/mojom/compositing/frame_sink_bundle.mojom";
import "services/viz/public/mojom/compositing/frame_sink_bundle_id.mojom";
import "services/viz/public/mojom/compositing/frame_sink_id.mojom";
import "services/viz/public/mojom/compositing/surface_info.mojom";
import "services/viz/public/mojom/compositing/local_surface_id.mojom";
// Interface from the the submitter to the embedder.
interface SurfaceEmbedder {
// Called by the embedee when a new LocalSurfaceId is allocated.
SetLocalSurfaceId(viz.mojom.LocalSurfaceId local_surface_id);
};
// Interface from browser to the embedder. Closing this interface will destroy
// the corresponding CompositorFrameSink if one exists.
interface EmbeddedFrameSinkClient {
// Called when a CompositorFrameSink is created for this frame sink.
// Establishes a direct connection from the embedee to the embedder.
BindSurfaceEmbedder(pending_receiver<SurfaceEmbedder> embedder);
};
// Provides embedded CompositorFrameSinks for the renderer. The renderer should
// first call RegisterEmbeddedFrameSink() to register an EmbeddedFrameSinkClient
// for the embedder and then call CreateCompositorFrameSink() to get the
// embedded CompositorFrameSink. The EmbeddedFrameSinkClient will be notified
// about surface activations.
interface EmbeddedFrameSinkProvider {
// Registers an embedded frame sink for |frame_sink_id|. The FrameSinkId of
// the parent must be specified at this time.
RegisterEmbeddedFrameSink(viz.mojom.FrameSinkId parent_frame_sink_id,
viz.mojom.FrameSinkId frame_sink_id,
pending_remote<EmbeddedFrameSinkClient> client);
// Registers a bundle of frame sinks identified by `bundle_id`. The
// FrameSinkBundle and FrameSinkBundleClient endpoints are used to perform
// batched communication between Viz and the client, regarding any of the
// frame sinks included in the bundle. See CreateBundledCompositorFrameSink()
// below.
RegisterEmbeddedFrameSinkBundle(
viz.mojom.FrameSinkBundleId bundle_id,
pending_receiver<viz.mojom.FrameSinkBundle> receiver,
pending_remote<viz.mojom.FrameSinkBundleClient> client);
// Create a CompositorFrameSink for |frame_sink_id|. This must happen after
// calling RegisterEmbeddedFrameSink() for |frame_sink_id|.
CreateCompositorFrameSink(viz.mojom.FrameSinkId frame_sink_id,
pending_remote<viz.mojom.CompositorFrameSinkClient> client,
pending_receiver<viz.mojom.CompositorFrameSink> sink);
// Similar to above, but the frame sink can also be controlled by the
// corresponding FrameSinkBundle interface. See
// RegisterEmbeddedFrameSinkBundle() above.
CreateBundledCompositorFrameSink(
viz.mojom.FrameSinkId frame_sink_id,
viz.mojom.FrameSinkBundleId bundle_id,
pending_remote<viz.mojom.CompositorFrameSinkClient> client,
pending_receiver<viz.mojom.CompositorFrameSink> sink);
// Create CompositorFrameSink directly in a single call (instead of going
// through both function above).
CreateSimpleCompositorFrameSink(viz.mojom.FrameSinkId parent_frame_sink_id,
viz.mojom.FrameSinkId frame_sink_id,
pending_remote<EmbeddedFrameSinkClient> surface_client,
pending_remote<viz.mojom.CompositorFrameSinkClient> client,
pending_receiver<viz.mojom.CompositorFrameSink> sink);
// Establishes a direct connection to the embedder of |frame_sink_id|. This
// will allow the client to let the embedder know what LocalSurfaceId it is
// using.
ConnectToEmbedder(viz.mojom.FrameSinkId frame_sink_id,
pending_receiver<SurfaceEmbedder> embedder);
// Registers |frame_sink_id| as the child of its parent frame sink ID, which
// has been specified at frame sink creation time. The registration usually
// happens automatically when the frame sink is created in
// CreateCompositorFrameSink(), and here the client may want to manually
// control the registration.
RegisterFrameSinkHierarchy(viz.mojom.FrameSinkId frame_sink_id);
// Unregisters |frame_sink_id| as the child of its parent frame sink ID, which
// has been specified at frame sink creation time. The un-registration usually
// happens automatically when the frame sink is destructed, and here the
// client may want to manually control the un-registration.
UnregisterFrameSinkHierarchy(viz.mojom.FrameSinkId frame_sink_id);
};