#include <pipeline.h>
Classes | |
| class | ProducerContinuation |
Public Types | |
| using | Resource = R |
| using | ResourcePtr = std::unique_ptr< Resource > |
| using | Consumer = std::function< void(ResourcePtr)> |
Public Member Functions | |
| Pipeline (uint32_t depth) | |
| ~Pipeline ()=default | |
| bool | IsValid () const |
| ProducerContinuation | Produce () |
| ProducerContinuation | ProduceIfEmpty () |
| PipelineConsumeResult | Consume (const Consumer &consumer) |
A thread-safe queue of resources for a single consumer and a single producer, with a maximum queue depth.
Pipelines support two key operations: produce and consume.
The consumer calls |Consume| to wait for a resource to be produced and consume it when ready.
The producer calls |Produce| to generate a ProducerContinuation which provides a means to enqueue a resource in the pipeline, if the pipeline is below its maximum depth. When the resource has been prepared, the producer calls Complete on the continuation, which enqueues the resource and signals the waiting consumer.
Pipelines generate the following tracing information:
ProducerContinuation with a resource.The primary use of this class is as the frame pipeline used in Flutter's animator/rasterizer.
Definition at line 64 of file pipeline.h.
| using flutter::Pipeline< R >::Consumer = std::function<void(ResourcePtr)> |
Definition at line 180 of file pipeline.h.
| using flutter::Pipeline< R >::Resource = R |
Definition at line 66 of file pipeline.h.
| using flutter::Pipeline< R >::ResourcePtr = std::unique_ptr<Resource> |
Definition at line 67 of file pipeline.h.
|
inlineexplicit |
Definition at line 131 of file pipeline.h.
|
default |
|
inline |
Definition at line 183 of file pipeline.h.
References fml::Semaphore::Signal(), TRACE_EVENT_ASYNC_END0, TRACE_FLOW_END, and fml::Semaphore::TryWait().
|
inline |
Definition at line 136 of file pipeline.h.
References fml::Semaphore::IsValid().
|
inline |
Creates a ProducerContinuation that a producer can use to add a resource to the queue.
If the queue is already at its maximum depth, the ProducerContinuation is returned with success = false.
Definition at line 143 of file pipeline.h.
References FML_TRACE_COUNTER, flutter::GetNextPipelineTraceID(), and fml::Semaphore::TryWait().
|
inline |
Creates a ProducerContinuation that will only push the task if the queue is empty.
Prefer using |Produce|. ProducerContinuation returned by this method doesn't guarantee that the frame will be rendered.
Definition at line 164 of file pipeline.h.
References FML_TRACE_COUNTER, flutter::GetNextPipelineTraceID(), and fml::Semaphore::TryWait().