Storage for Overlay layers across frames. More...
#include <overlay_layer_pool.h>
Public Member Functions | |
OverlayLayerPool ()=default | |
~OverlayLayerPool ()=default | |
std::shared_ptr< OverlayLayer > | GetNextLayer () |
Gets a layer from the pool if available. More... | |
void | CreateLayer (GrDirectContext *gr_context, const std::shared_ptr< IOSContext > &ios_context, MTLPixelFormat pixel_format) |
Create a new overlay layer. More... | |
std::vector< std::shared_ptr< OverlayLayer > > | RemoveUnusedLayers () |
Removes unused layers from the pool. Returns the unused layers. More... | |
void | RecycleLayers () |
Marks the layers in the pool as available for reuse. More... | |
size_t | size () const |
The count of layers currently in the pool. More... | |
Storage for Overlay layers across frames.
Note: this class does not synchronize access to its layers or any layer removal. As it is currently used, layers must be created on the platform thread but other methods of it are called on the raster thread. This is safe as overlay layers are only ever added while the raster thread is latched.
Definition at line 53 of file overlay_layer_pool.h.
|
default |
|
default |
void flutter::OverlayLayerPool::CreateLayer | ( | GrDirectContext * | gr_context, |
const std::shared_ptr< IOSContext > & | ios_context, | ||
MTLPixelFormat | pixel_format | ||
) |
Create a new overlay layer.
This method can only be called on the Platform thread.
Definition at line 57 of file overlay_layer_pool.mm.
References flutter::IOSSurface::Create().
std::shared_ptr< OverlayLayer > flutter::OverlayLayerPool::GetNextLayer | ( | ) |
Gets a layer from the pool if available.
The layer is marked as used until [RecycleLayers] is called.
Definition at line 47 of file overlay_layer_pool.mm.
void flutter::OverlayLayerPool::RecycleLayers | ( | ) |
Marks the layers in the pool as available for reuse.
Definition at line 111 of file overlay_layer_pool.mm.
std::vector< std::shared_ptr< OverlayLayer > > flutter::OverlayLayerPool::RemoveUnusedLayers | ( | ) |
Removes unused layers from the pool. Returns the unused layers.
Definition at line 115 of file overlay_layer_pool.mm.
size_t flutter::OverlayLayerPool::size | ( | ) | const |
The count of layers currently in the pool.
Definition at line 132 of file overlay_layer_pool.mm.