Flutter Engine
The Flutter Engine
|
#include <task_source.h>
Classes | |
struct | TopTask |
Public Member Functions | |
TaskSource (TaskQueueId task_queue_id) | |
Construts a TaskSource with the given task_queue_id . More... | |
~TaskSource () | |
void | ShutDown () |
Drops the pending tasks from both primary and secondary task heaps. More... | |
void | RegisterTask (const DelayedTask &task) |
void | PopTask (TaskSourceGrade grade) |
Pops the task heap corresponding to the TaskSourceGrade . More... | |
size_t | GetNumPendingTasks () const |
bool | IsEmpty () const |
Returns true if GetNumPendingTasks is zero. More... | |
TopTask | Top () const |
void | PauseSecondary () |
Pause providing tasks from secondary task heap. More... | |
void | ResumeSecondary () |
Resume providing tasks from secondary task heap. More... | |
A Source of tasks for the MessageLoopTaskQueues
task dispatcher. This is a wrapper around a primary and secondary task heap with the difference between them being that the secondary task heap can be paused and resumed by the task dispatcher. TaskSourceGrade
determines what task heap the task is assigned to.
The task dispatcher associates a task source with each TaskQueueID
. When the user of the task dispatcher registers a task, the task is in-turn registered with the TaskSource
corresponding to the TaskQueueID
.
Task dispatcher provides the event loop a way to acquire tasks to run via GetNextTaskToRun
. Task dispatcher asks the underlying TaskSource
for the next task.
Definition at line 35 of file task_source.h.
|
explicit |
Construts a TaskSource with the given task_queue_id
.
Definition at line 11 of file task_source.cc.
fml::TaskSource::~TaskSource | ( | ) |
Definition at line 14 of file task_source.cc.
size_t fml::TaskSource::GetNumPendingTasks | ( | ) | const |
Returns the number of pending tasks. Excludes the tasks from the secondary heap if it's paused.
Definition at line 51 of file task_source.cc.
bool fml::TaskSource::IsEmpty | ( | ) | const |
void fml::TaskSource::PauseSecondary | ( | ) |
Pause providing tasks from secondary task heap.
Definition at line 94 of file task_source.cc.
void fml::TaskSource::PopTask | ( | TaskSourceGrade | grade | ) |
Pops the task heap corresponding to the TaskSourceGrade
.
Definition at line 37 of file task_source.cc.
void fml::TaskSource::RegisterTask | ( | const DelayedTask & | task | ) |
Adds a task to the corresponding task heap as dictated by the TaskSourceGrade
of the DelayedTask
.
Definition at line 23 of file task_source.cc.
void fml::TaskSource::ResumeSecondary | ( | ) |
Resume providing tasks from secondary task heap.
Definition at line 98 of file task_source.cc.
void fml::TaskSource::ShutDown | ( | ) |
Drops the pending tasks from both primary and secondary task heaps.
Definition at line 18 of file task_source.cc.
TaskSource::TopTask fml::TaskSource::Top | ( | ) | const |
Returns the top task based on scheduled time, taking into account whether the secondary heap has been paused or not.
Definition at line 63 of file task_source.cc.