Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
flutter::SkiaConcurrentExecutor Class Reference

An interface used by Skia to schedule work on engine managed threads (usually workers in a concurrent message loop). More...

#include <skia_concurrent_executor.h>

Inheritance diagram for flutter::SkiaConcurrentExecutor:
SkExecutor

Public Types

using OnWorkCallback = std::function< void(fml::closure work)>
 

Public Member Functions

 SkiaConcurrentExecutor (const OnWorkCallback &on_work)
 Create a new instance of the executor.
 
 ~SkiaConcurrentExecutor () override
 
void add (fml::closure work) override
 
- Public Member Functions inherited from SkExecutor
virtual ~SkExecutor ()
 
virtual void add (std::function< void(void)>)=0
 
virtual void borrow ()
 

Additional Inherited Members

- Static Public Member Functions inherited from SkExecutor
static std::unique_ptr< SkExecutorMakeFIFOThreadPool (int threads=0, bool allowBorrowing=true)
 
static std::unique_ptr< SkExecutorMakeLIFOThreadPool (int threads=0, bool allowBorrowing=true)
 
static SkExecutorGetDefault ()
 
static void SetDefault (SkExecutor *)
 
- Protected Member Functions inherited from SkExecutor
 SkExecutor ()=default
 
 SkExecutor (const SkExecutor &)=delete
 
SkExecutoroperator= (const SkExecutor &)=delete
 

Detailed Description

An interface used by Skia to schedule work on engine managed threads (usually workers in a concurrent message loop).

Skia may decide that certain workloads don't have thread affinity and may be performed on a background thread. However, Skia does not manage its own threads. So, it delegates the scheduling of this work to the engine via this interface. The engine has a dedicated pool of threads it uses for scheduling background tasks that have no thread affinity. This thread worker pool is held next to the process global Dart VM instance. The Skia executor is wired up there as well.

Definition at line 27 of file skia_concurrent_executor.h.

Member Typedef Documentation

◆ OnWorkCallback

The callback invoked by the executor to schedule the given task onto an engine managed background thread.

Definition at line 33 of file skia_concurrent_executor.h.

Constructor & Destructor Documentation

◆ SkiaConcurrentExecutor()

flutter::SkiaConcurrentExecutor::SkiaConcurrentExecutor ( const OnWorkCallback on_work)
explicit

Create a new instance of the executor.

Parameters
[in]on_workThe work callback.

Definition at line 11 of file skia_concurrent_executor.cc.

12 : on_work_(on_work) {}

◆ ~SkiaConcurrentExecutor()

flutter::SkiaConcurrentExecutor::~SkiaConcurrentExecutor ( )
overridedefault

Member Function Documentation

◆ add()

void flutter::SkiaConcurrentExecutor::add ( fml::closure  work)
override

Definition at line 16 of file skia_concurrent_executor.cc.

16 {
17 if (!work) {
18 return;
19 }
20 on_work_([work]() {
21 TRACE_EVENT0("flutter", "SkiaExecutor");
22 work();
23 });
24}
#define TRACE_EVENT0(category_group, name)

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