diff --git a/engine/src/flutter/shell/platform/linux/fl_engine.cc b/engine/src/flutter/shell/platform/linux/fl_engine.cc index 257b19c8..cbb96f33 100644 --- a/engine/src/flutter/shell/platform/linux/fl_engine.cc +++ b/engine/src/flutter/shell/platform/linux/fl_engine.cc @@ -583,3 +583,9 @@ void fl_engine_execute_task(FlEngine* self, FlutterTask* task) { g_warning("Failed to run task"); } } + +G_MODULE_EXPORT void fl_engine_poll_task_runner(FlEngine* self) { + g_return_if_fail(FL_IS_ENGINE(self)); + + fl_task_runner_wait(self->task_runner); +} diff --git a/engine/src/flutter/shell/platform/linux/public/flutter_linux/fl_engine.h b/engine/src/flutter/shell/platform/linux/public/flutter_linux/fl_engine.h index d2c0c55d..94fc5aa9 100644 --- a/engine/src/flutter/shell/platform/linux/public/flutter_linux/fl_engine.h +++ b/engine/src/flutter/shell/platform/linux/public/flutter_linux/fl_engine.h @@ -70,6 +70,13 @@ gboolean fl_engine_start(FlEngine* engine, GError** error); */ FlBinaryMessenger* fl_engine_get_binary_messenger(FlEngine* engine); +/* + * Blocks until a Flutter message is posted on task runner and then processes + * it. Must be called on platform thread. During polling no other system + * messages are processed. + */ +void fl_engine_poll_task_runner(FlEngine* self); + G_END_DECLS #endif // FLUTTER_SHELL_PLATFORM_LINUX_PUBLIC_FLUTTER_LINUX_FL_ENGINE_H_