Flutter Linux Embedder
fl_task_runner.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_SHELL_PLATFORM_LINUX_FL_TASK_RUNNER_H_
6 #define FLUTTER_SHELL_PLATFORM_LINUX_FL_TASK_RUNNER_H_
7 
8 #include <glib-object.h>
9 
10 #include "flutter/shell/platform/embedder/embedder.h"
12 
13 G_BEGIN_DECLS
14 
15 G_DECLARE_FINAL_TYPE(FlTaskRunner, fl_task_runner, FL, TASK_RUNNER, GObject);
16 
17 /**
18  * fl_task_runner_new:
19  * @engine: the #FlEngine owning the task runner.
20  *
21  * Creates new task runner instance.
22  *
23  * Returns: an #FlTaskRunner.
24  */
25 FlTaskRunner* fl_task_runner_new(FlEngine* engine);
26 
27 /**
28  * fl_task_runner_post_task:
29  * @task_runner: an #FlTaskRunner.
30  * @task: Flutter task being scheduled
31  * @target_time_nanos: absolute time in nanoseconds
32  *
33  * Posts a Flutter task to be executed on main thread. This function is thread
34  * safe and may be called from any thread.
35  */
36 void fl_task_runner_post_task(FlTaskRunner* task_runner,
37  FlutterTask task,
38  uint64_t target_time_nanos);
39 
40 /**
41  * fl_task_runner_block_main_thread:
42  * @task_runner: an #FlTaskRunner.
43  *
44  * Blocks main thread until fl_task_runner_release_main_thread is called.
45  * While main thread is blocked tasks posted to #FlTaskRunner are executed as
46  * usual.
47  * Must be invoked on main thread.
48  */
49 void fl_task_runner_block_main_thread(FlTaskRunner* task_runner);
50 
51 /**
52  * fl_task_runner_release_main_thread:
53  * @task_runner: an #FlTaskRunner.
54  *
55  * Unblocks main thread. This will resume normal processing of main loop.
56  * Can be invoked from any thread.
57  */
58 void fl_task_runner_release_main_thread(FlTaskRunner* self);
59 
60 G_END_DECLS
61 
62 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_TASK_RUNNER_H_
G_DECLARE_FINAL_TYPE
G_BEGIN_DECLS G_DECLARE_FINAL_TYPE(FlTaskRunner, fl_task_runner, FL, TASK_RUNNER, GObject)
fl_task_runner_block_main_thread
void fl_task_runner_block_main_thread(FlTaskRunner *task_runner)
Definition: fl_task_runner.cc:176
fl_task_runner_release_main_thread
void fl_task_runner_release_main_thread(FlTaskRunner *self)
Definition: fl_task_runner.cc:197
fl_task_runner_post_task
void fl_task_runner_post_task(FlTaskRunner *task_runner, FlutterTask task, uint64_t target_time_nanos)
Definition: fl_task_runner.cc:161
FL
FL
Definition: fl_binary_messenger.cc:27
fl_task_runner_new
FlTaskRunner * fl_task_runner_new(FlEngine *engine)
Definition: fl_task_runner.cc:154
fl_engine.h