5#define FML_USED_ON_EMBEDDER
7#include "flutter/fml/task_source.h"
12 : task_queue_id_(task_queue_id) {}
19 primary_task_queue_ = {};
20 secondary_task_queue_ = {};
26 primary_task_queue_.push(task);
29 primary_task_queue_.push(task);
32 secondary_task_queue_.push(task);
40 primary_task_queue_.pop();
43 primary_task_queue_.pop();
46 secondary_task_queue_.pop();
52 size_t size = primary_task_queue_.size();
53 if (secondary_pause_requests_ == 0) {
54 size += secondary_task_queue_.size();
65 if (secondary_pause_requests_ > 0 || secondary_task_queue_.empty()) {
66 const auto& primary_top = primary_task_queue_.top();
68 .task_queue_id = task_queue_id_,
71 }
else if (primary_task_queue_.empty()) {
72 const auto& secondary_top = secondary_task_queue_.top();
74 .task_queue_id = task_queue_id_,
75 .task = secondary_top,
78 const auto& primary_top = primary_task_queue_.top();
79 const auto& secondary_top = secondary_task_queue_.top();
80 if (primary_top > secondary_top) {
82 .task_queue_id = task_queue_id_,
83 .task = secondary_top,
87 .task_queue_id = task_queue_id_,
95 secondary_pause_requests_++;
99 secondary_pause_requests_--;
fml::TaskSourceGrade GetTaskSourceGrade() const
void ShutDown()
Drops the pending tasks from both primary and secondary task heaps.
bool IsEmpty() const
Returns true if GetNumPendingTasks is zero.
void RegisterTask(const DelayedTask &task)
void ResumeSecondary()
Resume providing tasks from secondary task heap.
TaskSource(TaskQueueId task_queue_id)
Construts a TaskSource with the given task_queue_id.
void PauseSecondary()
Pause providing tasks from secondary task heap.
void PopTask(TaskSourceGrade grade)
Pops the task heap corresponding to the TaskSourceGrade.
size_t GetNumPendingTasks() const
#define FML_CHECK(condition)
#define FML_DCHECK(condition)
constexpr std::size_t size(T(&array)[N])
@ kUnspecified
The absence of a specialized TaskSourceGrade.