OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 module mojo.gfx; | 5 module mojo.gfx; |
6 | 6 |
7 import "geometry/interfaces/geometry.mojom"; | 7 import "geometry/interfaces/geometry.mojom"; |
8 import "gfx/images/interfaces/image.mojom"; | 8 import "gfx/images/interfaces/image.mojom"; |
9 | 9 |
10 // The status of the last time this image was presented | 10 // The status of the last time this image was presented |
11 enum PresentationStatus { | 11 enum PresentationStatus { |
12 PRESENTED = 0, | 12 PRESENTED = 0, |
13 // Image properties are not supported by the consumer | 13 // Image properties are not supported by the consumer |
14 NOT_PRESENTED_INVALID_PROPERTIES = 1, | 14 NOT_PRESENTED_INVALID_PROPERTIES = 1, |
15 // Producer flushed the image pool | 15 // Producer flushed the image pool |
16 NOT_PRESENTED_FLUSHED = 2, | 16 NOT_PRESENTED_FLUSHED = 2, |
17 }; | 17 }; |
18 | 18 |
19 // ImagePipe is a mechanism for streaming shared images between two | 19 // ImagePipe is a mechanism for streaming shared images between two |
20 // Mojo entities, one of which provides the image contents (the 'producer') and | 20 // Mojo entities, one of which provides the image contents (the 'producer') and |
21 // one of which does something with the image contents (the 'consumer'). | 21 // one of which does something with the image contents (the 'consumer'). |
22 // It operates conceptually on a pool of |Image| objects that the pipe knows | 22 // It operates conceptually on a pool of |Image| objects that the pipe knows |
23 // about, allows image producers to add/remove images to/from this pool, and | 23 // about, allows image producers to add/remove images to/from this pool, and |
24 // provides mechanisms for the producer and the consumer to negotiate about who | 24 // provides mechanisms for the producer and the consumer to negotiate about who |
25 // owns each image in the pool at a given point in time. | 25 // owns each image in the pool at a given point in time. |
26 interface ImagePipe { | 26 interface ImagePipe { |
27 | |
28 // Add an image persistently to the pipe's image pool | 27 // Add an image persistently to the pipe's image pool |
29 // Adding an image that is already added, or using an ID that is already in | 28 // Adding an image that is already added, or using an ID that is already in |
30 // use are both errors and will cause the connection to close. | 29 // use are both errors and will cause the connection to close. |
31 AddImage(Image image, uint32 id); | 30 AddImage(Image image, uint32 id); |
32 | 31 |
33 // Remove an image from the pipe's pool | 32 // Remove an image from the pipe's pool |
34 // Use of an invalid ID will cause the connection to close. | 33 // Use of an invalid ID will cause the connection to close. |
35 RemoveImage(uint32 id); | 34 RemoveImage(uint32 id); |
36 | 35 |
37 // Mark the image as available for consumption by the consumer | 36 // Mark the image as available for consumption by the consumer |
38 // The reply will be sent when the consumer is done using this image and | 37 // The reply will be sent when the consumer is done using this image and |
39 // is ready to release ownership back to the producer. | 38 // is ready to release ownership back to the producer. |
40 // The reply will not be sent until another Image is presented to replace it | 39 // The reply will not be sent until another Image is presented to replace it |
41 // presentuing an id that is added will cause the connection to close. | 40 // presentuing an id that is added will cause the connection to close. |
42 PresentImage(uint32 id) => (PresentationStatus status); | 41 PresentImage(uint32 id) => (PresentationStatus status); |
43 | 42 |
44 // Ask the consumer to release all images in the pipe's pool. This will | 43 // Ask the consumer to release all images in the pipe's pool. This will |
45 // send the presentation reply with FLUSHED on all images in the pool | 44 // send the presentation reply with FLUSHED on all images in the pool |
46 // not being used by the consumer if the consumer is presenting this image, | 45 // not being used by the consumer if the consumer is presenting this image, |
47 // that image may still be presented and its Present reply will reflect that. | 46 // that image may still be presented and its Present reply will reflect that. |
48 FlushImages(); | 47 FlushImages(); |
49 | 48 }; |
50 }; | |
OLD | NEW |