Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
impeller::PipelineCompileQueueGLES Class Reference

A task queue designed for managing compilation of pipeline state objects for OpenGL ES backend. More...

#include <pipeline_compile_queue_gles.h>

Inheritance diagram for impeller::PipelineCompileQueueGLES:
impeller::PipelineCompileQueue

Public Member Functions

 ~PipelineCompileQueueGLES () override
 
 PipelineCompileQueueGLES (const PipelineCompileQueueGLES &)=delete
 
PipelineCompileQueueGLESoperator= (const PipelineCompileQueueGLES &)=delete
 
void PostJob (const fml::closure &job) override
 Post a compilation job to the worker task runner.
 
void OnJobAdded () override
 Called by PostJobForDescriptor after a job has been successfully added to the queue. Subclasses must implement this to define their scheduling strategy.
 
- Public Member Functions inherited from impeller::PipelineCompileQueue
 PipelineCompileQueue ()=default
 
virtual ~PipelineCompileQueue ()
 
 PipelineCompileQueue (const PipelineCompileQueue &)=delete
 
PipelineCompileQueueoperator= (const PipelineCompileQueue &)=delete
 
bool PostJobForDescriptor (const PipelineDescriptor &desc, const fml::closure &job)
 Post a compile job for the specified descriptor.
 
void PerformJobEagerly (const PipelineDescriptor &desc)
 If the task has not yet been done, perform it eagerly on the calling thread. This can be used in lieu of an idle wait for the task completion on the calling thread.
 

Static Public Member Functions

static std::shared_ptr< PipelineCompileQueueGLESCreate (std::shared_ptr< fml::BasicTaskRunner > worker_task_runner)
 

Additional Inherited Members

- Protected Member Functions inherited from impeller::PipelineCompileQueue
void DoOneJob ()
 Execute one pending compilation job from the queue.
 
bool AddJob (const PipelineDescriptor &desc, const fml::closure &job)
 Add a compilation job to the pending queue for the specified descriptor.
 
bool HasPendingJobs ()
 Check if there are any pending compilation jobs in the queue.
 

Detailed Description

A task queue designed for managing compilation of pipeline state objects for OpenGL ES backend.

This subclass uses a fml::TaskRunner as the worker task runner and implements a sequential job processing mechanism to prevent blocking the IO task runner.

Key characteristics:

  • Uses fml::RefPtr<fml::TaskRunner> for worker_task_runner_
  • Processes jobs sequentially: loads one job at a time before proceeding to the next, preventing IO task runner blocking
  • Uses DrainPendingJobs() to recursively process jobs one by one
  • Employs is_processing_ flag and processing_mutex_ to control sequential processing

The sequential processing ensures that pipeline compilation jobs do not overwhelm the task runner, which is particularly important for GLES backend where resource loading patterns differ from Vulkan.

Definition at line 36 of file pipeline_compile_queue_gles.h.

Constructor & Destructor Documentation

◆ ~PipelineCompileQueueGLES()

impeller::PipelineCompileQueueGLES::~PipelineCompileQueueGLES ( )
overridedefault

◆ PipelineCompileQueueGLES()

impeller::PipelineCompileQueueGLES::PipelineCompileQueueGLES ( const PipelineCompileQueueGLES )
delete

Member Function Documentation

◆ Create()

std::shared_ptr< PipelineCompileQueueGLES > impeller::PipelineCompileQueueGLES::Create ( std::shared_ptr< fml::BasicTaskRunner worker_task_runner)
static

Definition at line 13 of file pipeline_compile_queue_gles.cc.

14 {
15 if (!worker_task_runner) {
16 return nullptr;
17 }
18 return std::shared_ptr<PipelineCompileQueueGLES>(
19 new PipelineCompileQueueGLES(std::move(worker_task_runner)));
20}
PipelineCompileQueueGLES(const PipelineCompileQueueGLES &)=delete

Referenced by impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), impeller::testing::TEST(), and impeller::testing::TEST().

◆ OnJobAdded()

void impeller::PipelineCompileQueueGLES::OnJobAdded ( )
overridevirtual

Called by PostJobForDescriptor after a job has been successfully added to the queue. Subclasses must implement this to define their scheduling strategy.

The default implementation for duplicate descriptors is to run the job eagerly. Subclasses can override this behavior by checking for duplicates before calling the base class.

Implements impeller::PipelineCompileQueue.

Definition at line 28 of file pipeline_compile_queue_gles.cc.

28 {
29 // To prevent potential deadlocks and reduce lock contention, avoid calling
30 // external or virtual methods (such as DrainPendingJobs, which posts tasks
31 // to the task runner) while holding a mutex. Instead, minimize the scope of
32 // the lock by using a local boolean flag to trigger the draining process
33 // outside the lock block.
34 bool should_drain = false;
35 {
36 Lock lock(processing_mutex_);
37 if (!is_processing_) {
38 is_processing_ = true;
39 should_drain = true;
40 }
41 }
42 if (should_drain) {
43 DrainPendingJobs();
44 }
45}

◆ operator=()

PipelineCompileQueueGLES & impeller::PipelineCompileQueueGLES::operator= ( const PipelineCompileQueueGLES )
delete

◆ PostJob()

void impeller::PipelineCompileQueueGLES::PostJob ( const fml::closure job)
overridevirtual

Post a compilation job to the worker task runner.

        This is a pure virtual function that must be implemented by
        subclasses. It is responsible for actually dispatching the
        job closure to the appropriate task runner for execution.
Parameters
[in]jobThe compilation job closure to post

Implements impeller::PipelineCompileQueue.

Definition at line 47 of file pipeline_compile_queue_gles.cc.

47 {
48 if (!job) {
49 return;
50 }
51
52 worker_task_runner_->PostTask(job);
53}

The documentation for this class was generated from the following files: