michael@0: /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: include LayersSurfaces; michael@0: include LayersMessages; michael@0: include protocol PGrallocBuffer; michael@0: include protocol PCompositable; michael@0: include protocol PTexture; michael@0: include ProtocolTypes; michael@0: michael@0: include "mozilla/GfxMessageUtils.h"; michael@0: michael@0: using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h"; michael@0: michael@0: namespace mozilla { michael@0: namespace layers { michael@0: michael@0: /** michael@0: * The PImageBridge protocol is used to allow isolated threads or processes to push michael@0: * frames directly to the compositor thread/process without relying on the main thread michael@0: * which might be too busy dealing with content script. michael@0: */ michael@0: intr protocol PImageBridge michael@0: { michael@0: manages PCompositable; michael@0: manages PGrallocBuffer; michael@0: manages PTexture; michael@0: michael@0: parent: michael@0: michael@0: sync Update(CompositableOperation[] ops) returns (EditReply[] reply); michael@0: async UpdateNoSwap(CompositableOperation[] ops); michael@0: michael@0: // Allocates a gralloc buffer that may not suitable to use with michael@0: // gfxImageSurface but allows hardware decoder to write to the michael@0: // buffer directly. The format is a enum defined in michael@0: // system/graphics.h and the usage is the GraphicBuffer usage michael@0: // flag. See GraphicBuffer.h and gralloc.h. michael@0: sync PGrallocBuffer(IntSize size, uint32_t format, uint32_t usage) michael@0: returns (MaybeMagicGrallocBufferHandle handle); michael@0: michael@0: // First step of the destruction sequence. This puts ImageBridge michael@0: // in a state in which it can't send asynchronous messages michael@0: // so as to not race with the upcomming Stop message and destruction. michael@0: // In the child side, the Stop message is not sent right after WillStop, michael@0: // it is scheduled in the ImageBridgeChild's message queue in order to ensure michael@0: // that all of the messages from the parent side have been received and processed michael@0: // before sending Stop, and that after Stop returns, there is no message in michael@0: // flight on any side and we can safely destroy the channel and threads. michael@0: sync WillStop(); michael@0: // Second step michael@0: sync Stop(); michael@0: michael@0: sync PCompositable(TextureInfo aInfo) returns (uint64_t id); michael@0: async PTexture(SurfaceDescriptor aSharedData, uint32_t aTextureFlags); michael@0: }; michael@0: michael@0: michael@0: } // namespace michael@0: } // namespace michael@0: