Flutter Engine
The Flutter Engine
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"
11#include "flutter/shell/platform/linux/public/flutter_linux/fl_engine.h"
12
13G_BEGIN_DECLS
14
15G_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 */
25FlTaskRunner* 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 */
36void 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 */
49void 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 */
59
60G_END_DECLS
61
62#endif // FLUTTER_SHELL_PLATFORM_LINUX_FL_TASK_RUNNER_H_
FlutterEngine engine
Definition: main.cc:68
G_BEGIN_DECLS G_DECLARE_FINAL_TYPE(FlTaskRunner, fl_task_runner, FL, TASK_RUNNER, GObject)
FlTaskRunner * fl_task_runner_new(FlEngine *engine)
void fl_task_runner_release_main_thread(FlTaskRunner *self)
void fl_task_runner_post_task(FlTaskRunner *task_runner, FlutterTask task, uint64_t target_time_nanos)
void fl_task_runner_block_main_thread(FlTaskRunner *task_runner)