5#include "flutter/shell/platform/glfw/event_loop.h"
14 : main_thread_id_(main_thread_id), on_task_expired_(on_task_expired) {}
23 const auto now = TaskTimePoint::clock::now();
24 std::vector<FlutterTask> expired_tasks;
33 if (top.fire_time > now) {
51 for (
const auto& task : expired_tasks) {
68 next_wake =
std::min(max_wake_timepoint, next_event_timepoint);
75 uint64_t flutter_target_time_nanos) {
76 const auto now = TaskTimePoint::clock::now();
77 const int64_t flutter_duration =
79 return now + std::chrono::nanoseconds(flutter_duration);
83 uint64_t flutter_target_time_nanos) {
84 static std::atomic_uint64_t sGlobalTaskOrder(0);
87 task.
order = ++sGlobalTaskOrder;
89 task.
task = flutter_task;
void PostTask(FlutterTask flutter_task, uint64_t flutter_target_time_nanos)
static TaskTimePoint TimePointFromFlutterTime(uint64_t flutter_target_time_nanos)
EventLoop(std::thread::id main_thread_id, const TaskExpiredCallback &on_task_expired)
std::priority_queue< Task, std::deque< Task >, Task::Comparer > task_queue_
bool RunsTasksOnCurrentThread() const
std::mutex task_queue_mutex_
virtual void WaitUntil(const TaskTimePoint &time)=0
TaskExpiredCallback on_task_expired_
std::function< void(const FlutterTask *)> TaskExpiredCallback
std::thread::id main_thread_id_
std::chrono::steady_clock::time_point TaskTimePoint
void WaitForEvents(std::chrono::nanoseconds max_wait=std::chrono::nanoseconds::max())
uint64_t FlutterEngineGetCurrentTime()
Get the current time in nanoseconds from the clock used by the flutter engine. This is the system mon...
static float max(float r, float g, float b)
static float min(float r, float g, float b)