| // Copyright 2016 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module cc.mojom; |
| |
| import "cc/ipc/frame_sink_id.mojom"; |
| import "cc/ipc/local_surface_id.mojom"; |
| import "cc/ipc/compositor_frame_sink.mojom"; |
| import "cc/ipc/surface_id.mojom"; |
| import "cc/ipc/surface_info.mojom"; |
| import "gpu/ipc/common/surface_handle.mojom"; |
| import "mojo/common/time.mojom"; |
| import "ui/gfx/geometry/mojo/geometry.mojom"; |
| import "ui/gfx/mojo/color_space.mojom"; |
| |
| // See ui/compositor/compositor.h: ContextFactoryPrivate. |
| // The DisplayPrivate is used by privileged clients to talk to cc::Display. |
| // DisplayPrivate would eventually replace or be used by ContextFactoryPrivate. |
| interface DisplayPrivate { |
| SetDisplayVisible(bool visible); |
| ResizeDisplay(gfx.mojom.Size size_in_pixel); |
| SetDisplayColorSpace(gfx.mojom.ColorSpace color_space); |
| SetOutputIsSecure(bool secure); |
| SetLocalSurfaceId(cc.mojom.LocalSurfaceId local_surface_id, |
| float scale_factor); |
| }; |
| |
| // The FrameSinkManager interface is a privileged interface that allows the |
| // frame sink manager host (browser or window server) to create |
| // CompositorFrameSinks. Clients acquire a CompositorFrameSink connection |
| // through the frame sink manager host. Clients request a CompositorFrameSink |
| // interface, and implement a CompositorFrameSinkClient interface. The frame |
| // sink manager host holds one or more display CompositorFrameSinks that are |
| // tied to a valid |surface_handle| and cc::Display. All other |
| // CompositorFrameSinks must be parented by another CompositorFrameSink. |
| // FrameSinkIds are fixed for a given client and are determined ahead of time. |
| // Thus, a client will typically simply request a CompositorFrameSink from the |
| // frame sink manager host which will forward the request to the frame sink |
| // manager. |
| interface FrameSinkManager { |
| // Create a CompositorFrameSink for a privileged client (e.g. WindowServer). |
| // This is only used by privileged clients. The client can call methods that |
| // talks to the Display (e.g. ResizeDisplay(), SetDisplayVisible(), etc) |
| CreateRootCompositorFrameSink( |
| cc.mojom.FrameSinkId frame_sink_id, |
| gpu.mojom.SurfaceHandle widget, |
| associated cc.mojom.CompositorFrameSink& compositor_frame_sink, |
| cc.mojom.CompositorFrameSinkPrivate& compositor_frame_sink_private, |
| cc.mojom.CompositorFrameSinkClient compositor_frame_sink_client, |
| associated DisplayPrivate& display_private); |
| |
| // CreateCompositorFrameSink is used by unprivileged clients. This |
| // CompositorFrameSink is not a root, and has to be parented by another |
| // CompositorFrameSink in order to appear on screen. |
| CreateCompositorFrameSink( |
| cc.mojom.FrameSinkId frame_sink_id, |
| cc.mojom.CompositorFrameSink& compositor_frame_sink, |
| cc.mojom.CompositorFrameSinkPrivate& compositor_frame_sink_private, |
| cc.mojom.CompositorFrameSinkClient compositor_frame_sink_client); |
| |
| // Set up a BeginFrame relationship between two FrameSinkIds. In this case, |
| // the child inherits the BeginFrameSource from the parent if it doesn't |
| // already have a BeginFrameSource. |
| RegisterFrameSinkHierarchy(cc.mojom.FrameSinkId parent_frame_sink_id, |
| cc.mojom.FrameSinkId child_frame_sink_id); |
| |
| // Removes a BeginFrame relationship between two FrameSinkIds. |
| UnregisterFrameSinkHierarchy(cc.mojom.FrameSinkId parent_frame_sink_id, |
| cc.mojom.FrameSinkId child_frame_sink_id); |
| |
| // Drops the temporary reference for |surface_id|. This will get called when |
| // the FrameSinkManagerClient doesn't think |surface_id| will be embedded. |
| DropTemporaryReference(cc.mojom.SurfaceId surface_id); |
| }; |
| |
| // The FrameSinkManagerClient interface is implemented by the Display |
| // Compositor Host, a stable, and privileged peer service to the display |
| // compositor. The frame sink manager host is either the browser process in |
| // Chrome or the window server process. |
| interface FrameSinkManagerClient { |
| // Called by the frame sink manager immediately upon receiving a |
| // CompositorFrame with a new SurfaceId for the first time. |
| OnSurfaceCreated(SurfaceInfo surface_info); |
| |
| // The CompositorFrameSink pipe for |frame_sink_id| was closed. The client |
| // cannot submit any CompositorFrames to viz after this occurs. |
| OnClientConnectionClosed(cc.mojom.FrameSinkId frame_sink_id); |
| }; |