Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
headless_event_loop.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_GLFW_HEADLESS_EVENT_LOOP_H_
6#define FLUTTER_SHELL_PLATFORM_GLFW_HEADLESS_EVENT_LOOP_H_
7
8#include <condition_variable>
9
10#include "flutter/shell/platform/glfw/event_loop.h"
11
12namespace flutter {
13
14// An event loop implementation that only handles Flutter Engine task
15// scheduling.
17 public:
18 using TaskExpiredCallback = std::function<void(const FlutterTask*)>;
19 HeadlessEventLoop(std::thread::id main_thread_id,
20 const TaskExpiredCallback& on_task_expired);
21
23
24 // Disallow copy.
27
28 private:
29 // |EventLoop|
30 void WaitUntil(const TaskTimePoint& time) override;
31
32 // |EventLoop|
33 void Wake() override;
34
35 std::condition_variable task_queue_condition_;
36};
37
38} // namespace flutter
39
40#endif // FLUTTER_SHELL_PLATFORM_GLFW_HEADLESS_EVENT_LOOP_H_
std::chrono::steady_clock::time_point TaskTimePoint
Definition event_loop.h:50
HeadlessEventLoop(const HeadlessEventLoop &)=delete
HeadlessEventLoop & operator=(const HeadlessEventLoop &)=delete
void WaitUntil(const TaskTimePoint &time) override
std::function< void(const FlutterTask *)> TaskExpiredCallback