blob: b12c5ff4f76bf5dd314a51b07e92b5f01131b254 [file] [log] [blame]
// 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 mojo.gfx;
import "geometry/interfaces/geometry.mojom";
import "gfx/images/interfaces/image.mojom";
// The status of the last time this image was presented
enum PresentationStatus {
PRESENTED = 0,
// Image properties are not supported by the consumer
NOT_PRESENTED_INVALID_PROPERTIES = 1,
// Producer flushed the image pool
NOT_PRESENTED_FLUSHED = 2,
};
// ImagePipe is a mechanism for streaming shared images between two
// Mojo entities, one of which provides the image contents (the 'producer') and
// one of which does something with the image contents (the 'consumer').
// It operates conceptually on a pool of |Image| objects that the pipe knows
// about, allows image producers to add/remove images to/from this pool, and
// provides mechanisms for the producer and the consumer to negotiate about who
// owns each image in the pool at a given point in time.
interface ImagePipe {
// Add an image persistently to the pipe's image pool
// Adding an image that is already added, or using an ID that is already in
// use are both errors and will cause the connection to close.
AddImage(Image image, uint32 id);
// Remove an image from the pipe's pool
// Use of an invalid ID will cause the connection to close.
RemoveImage(uint32 id);
// Mark the image as available for consumption by the consumer
// The reply will be sent when the consumer is done using this image and
// is ready to release ownership back to the producer.
// The reply will not be sent until another Image is presented to replace it
// presentuing an id that is added will cause the connection to close.
PresentImage(uint32 id) => (PresentationStatus status);
// Ask the consumer to release all images in the pipe's pool. This will
// send the presentation reply with FLUSHED on all images in the pool
// not being used by the consumer if the consumer is presenting this image,
// that image may still be presented and its Present reply will reflect that.
FlushImages();
};