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_flutter_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_flutter_task(FlTaskRunner* task_runner,
37  FlutterTask task,
38  uint64_t target_time_nanos);
39 
40 /**
41  * fl_task_runner_wait:
42  * @task_runner: an #FlTaskRunner.
43  *
44  * Block until the next task is ready and then perform it. May be interrupted by
45  * fl_task_runner_stop_wait(), in which case no task is run but execution will
46  * be returned to the caller.
47  *
48  * Must be called only by the GTK thread.
49  */
50 void fl_task_runner_wait(FlTaskRunner* task_runner);
51 
52 /**
53  * fl_task_runner_stop_wait:
54  * @task_runner: an #FlTaskRunner.
55  *
56  * Cause fl_task_runner_wait() to complete. May be called even if
57  * fl_task_runner_wait() is not being used.
58  *
59  * May be called by any thread.
60  */
61 void fl_task_runner_stop_wait(FlTaskRunner* self);
62 
63 G_END_DECLS
64 
65 #endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_TASK_RUNNER_H_
G_BEGIN_DECLS G_DECLARE_FINAL_TYPE(FlTaskRunner, fl_task_runner, FL, TASK_RUNNER, GObject)
void fl_task_runner_stop_wait(FlTaskRunner *self)
void fl_task_runner_post_flutter_task(FlTaskRunner *task_runner, FlutterTask task, uint64_t target_time_nanos)
void fl_task_runner_wait(FlTaskRunner *task_runner)
FlTaskRunner * fl_task_runner_new(FlEngine *engine)