5#include "flutter/shell/platform/embedder/embedder_task_runner.h"
7#include "flutter/fml/message_loop_impl.h"
8#include "flutter/fml/message_loop_task_queues.h"
13 size_t embedder_identifier)
15 embedder_identifier_(embedder_identifier),
18 fml::MessageLoopTaskQueues::GetInstance()->CreateTaskQueue()) {
26 return embedder_identifier_;
33void EmbedderTaskRunner::PostTaskForTime(
const fml::closure& task,
43 std::scoped_lock lock(tasks_mutex_);
44 baton = ++last_baton_;
45 pending_tasks_[baton] = task;
51void EmbedderTaskRunner::PostDelayedTask(
const fml::closure& task,
56bool EmbedderTaskRunner::RunsTasksOnCurrentThread() {
64 std::scoped_lock lock(tasks_mutex_);
65 auto found = pending_tasks_.find(baton);
66 if (found == pending_tasks_.end()) {
67 FML_LOG(
ERROR) <<
"Embedder attempted to post an unknown task.";
71 pending_tasks_.erase(found);
83 return placeholder_id_;
bool PostTask(uint64_t baton)
size_t GetEmbedderIdentifier() const
The unique identifier provided by the embedder for the task runner. Embedders whose dispatch tables s...
EmbedderTaskRunner(DispatchTable table, size_t embedder_identifier)
Create a task runner with a dispatch table for delegation of task runner responsibility to the embedd...
~EmbedderTaskRunner() override
#define FML_LOG(severity)
#define FML_DCHECK(condition)
std::function< void()> closure
std::function< void(EmbedderTaskRunner *task_runner, uint64_t task_baton, fml::TimePoint target_time)> post_task_callback
std::function< bool(void)> runs_task_on_current_thread_callback