Flutter Engine
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:

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. More...
 
 ~SkiaConcurrentExecutor () override
 
void add (fml::closure work) override
 

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)

Create a new instance of the executor.

Parameters
[in]on_workThe work callback.

Definition at line 11 of file skia_concurrent_executor.cc.

References ~SkiaConcurrentExecutor().

12  : on_work_(on_work) {}

◆ ~SkiaConcurrentExecutor()

flutter::SkiaConcurrentExecutor::~SkiaConcurrentExecutor ( )
overridedefault

Referenced by SkiaConcurrentExecutor().

Member Function Documentation

◆ add()

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

Definition at line 16 of file skia_concurrent_executor.cc.

References TRACE_EVENT0.

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)
Definition: trace_event.h:75

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