Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 module mus.mojom; | |
| 6 | |
| 7 import "components/mus/public/interfaces/compositor_frame.mojom"; | |
| 8 | |
| 9 // Indicates whether the submitted CompositorFrame has been drawn to the display | |
| 10 // or has been skipped (e.g. another frame may have been submitted before | |
| 11 // vblank). | |
| 12 enum CompositorFrameDrawStatus { | |
| 13 DRAW_SKIPPED, | |
| 14 DRAWN | |
| 15 }; | |
| 16 | |
| 17 // A CompositorFrameSinkFactory represents a single Display client. | |
| 18 // The client (a process) can use this interface to create | |
| 19 // CompositorFrameSinks. | |
| 20 // TODO(fsamuel): This needs a better name. | |
| 21 interface CompositorFrameSinkFactory { | |
| 22 // Requests a CompositorFrameSink interface from the display compositor. | |
| 23 // A CompositorFrameSink has an associated ID consisting of three components: | |
| 24 // 1. Namespace picked by the service associated with this | |
| 25 // CompositorFrameSinkFactory | |
| 26 // 2. |local_id| which is a monotonically increasing ID allocated by the | |
| 27 // client. | |
| 28 // 3. |nonce| is a cryptographically secure random number making this Sink | |
|
rjkroege
2016/05/25 23:01:55
I am not convinced that nonce generation should be
Fady Samuel
2016/05/26 00:30:07
Doing nonce more securely on the service is harder
| |
| 29 // unguessable by other clients. | |
| 30 CreateCompositorFrameSink(uint32 local_id, | |
| 31 uint64 nonce, | |
| 32 CompositorFrameSink& sink, | |
| 33 CompositorFrameSinkClient client); | |
| 34 }; | |
| 35 | |
| 36 // A CompositorFrameSink is an interface for receiving CompositorFrame structs. | |
| 37 // A CompositorFrame contains the complete output meant for display. Each time a | |
|
rjkroege
2016/05/25 23:01:55
nit: This isn't quite true. But doesn't matter.
Fady Samuel
2016/05/26 00:30:07
Acknowledged.
| |
| 38 // client has a graphical update, and receives an OnBeginFrame, it is | |
| 39 // responsible for creating a CompositorFrame to update its portion of the | |
| 40 // screen. | |
| 41 interface CompositorFrameSink { | |
| 42 // After the submitted frame is either drawn for the first time by the display | |
| 43 // compositor or discarded, the callback will be called with the status of the | |
| 44 // submitted frame. Clients should use this acknowledgement to ratelimit frame | |
| 45 // submissions. | |
| 46 SubmitCompositorFrame(CompositorFrame frame) => | |
| 47 (CompositorFrameDrawStatus status); | |
|
rjkroege
2016/05/25 23:01:55
see previous comment set: I think we should suppor
Fady Samuel
2016/05/26 00:30:07
Done.
| |
| 48 | |
| 49 // Lets the display compositor know that the client wishes to receive the next | |
| 50 // BeginFrame event. | |
| 51 SetNeedsBeginFrame(bool needs_begin_frame); | |
| 52 | |
| 53 // TODO(fsamuel): ReadbackBitmap API would be useful here. | |
| 54 }; | |
| 55 | |
| 56 interface CompositorFrameSinkClient { | |
| 57 ReturnResources(array<ReturnedResource> resources); | |
| 58 }; | |
| 59 | |
| 60 // This is a public interface implemented by Display clients. | |
| 61 // Each client implements a single instance of the DisplayClient interface. | |
| 62 interface DisplayClient { | |
| 63 // The Mus Window Server is a root client, and so it will receive this | |
| 64 // callback. There can only be one root CompositorFrameSink per Display and so | |
| 65 // it does not get a CompositorFrameSinkFactory. | |
| 66 OnRootClientCreated(CompositorFrameSink sink, | |
|
rjkroege
2016/05/25 23:01:55
you are still forcing DisplayClient implementation
Fady Samuel
2016/05/26 00:30:07
Done. We now have a DisplayClient and DisplayHost.
| |
| 67 CompositorFrameSinkClient& client); | |
| 68 | |
| 69 // Non-root clients will receive this callback. Clients can create | |
| 70 // CompositorFrameSinks via the provided |factory|. | |
| 71 OnClientCreated(uint32 client_id, CompositorFrameSinkFactory factory); | |
| 72 | |
| 73 // TODO(fsamuel): OnBeginFrame needs to take a BeginFrameArgs instance per | |
| 74 // cc/output/begin_frame_args.h. | |
| 75 OnBeginFrame(); | |
| 76 }; | |
| OLD | NEW |