||Compositable client for 2d and webgl canvas.
||CompositableClient manages the texture-specific logic for composite layers,
independently of the layer. It is the content side of a CompositableClient/
CompositableClient's purpose is to send texture data to the compositor side
along with any extra information about how the texture is to be composited.
Things like opacity or transformation belong to layer and not compositable.
Since Compositables are independent of layers it is possible to create one,
connect it to the compositor side, and start sending images to it. This alone
is arguably not very useful, but it means that as long as a shadow layer can
do the proper magic to find a reference to the right CompositableHost on the
Compositor side, a Compositable client can be used outside of the main
shadow layer forwarder machinery that is used on the main thread.
The first step is to create a Compositable client and call Connect().
Connect() creates the underlying IPDL actor (see CompositableChild) and the
corresponding CompositableHost on the other side.
To do async texture transfer (like async-video), the CompositableClient
should be created with a different CompositableForwarder (like
ImageBridgeChild) and attachment is done with
CompositableForwarder::AttachAsyncCompositable that takes an identifier
instead of a CompositableChild, since the CompositableClient is not managed
by this layer forwarder (the matching uses a global map on the compositor
side, see CompositableMap in ImageBridgeParent.cpp)
Subclasses: Painted layers use ContentClients, ImageLayers use ImageClients,
Canvas layers use CanvasClients (but ImageHosts). We have a different
subclass where we have a different way of interfacing with the textures - in
terms of drawing into the compositable and/or passing its contents to the
||Image clients are used by basic image layers on the content thread, they
always match with an ImageHost on the compositor thread. See
CompositableClient.h for information on connecting clients to hosts.
||TextureChild is the content-side incarnation of the PTexture IPDL actor.
TextureChild is used to synchronize a texture client and its corresponding
TextureHost if needed (a TextureClient that is not shared with the compositor
does not have a TextureChild)
During the deallocation phase, a TextureChild may hold its recently destroyed
TextureClient's data until the compositor side confirmed that it is safe to
deallocte or recycle the it.
||TextureClient is the abstraction that allows us to share data between the
content and the compositor side.
||Return a TextureClient that is not yet ready to be reused, but will be
||TextureClientRecycleAllocator provides TextureClients allocation and
recycling capabilities. It expects allocations of same sizes and
attributres. If a recycled TextureClient is different from
requested one, the recycled one is dropped and new TextureClient is
By default this uses TextureClient::CreateForDrawing to allocate new texture