Flutter Engine
headless_event_loop.cc
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 #include "flutter/shell/platform/glfw/headless_event_loop.h"
6 
7 #include <atomic>
8 #include <utility>
9 
10 namespace flutter {
11 
13  const TaskExpiredCallback& on_task_expired)
14  : EventLoop(main_thread_id, std::move(on_task_expired)) {}
15 
17 
18 void HeadlessEventLoop::WaitUntil(const TaskTimePoint& time) {
19  std::mutex& mutex = GetTaskQueueMutex();
20  std::unique_lock<std::mutex> lock(mutex);
21  task_queue_condition_.wait_until(lock, time);
22 }
23 
24 void HeadlessEventLoop::Wake() {
25  task_queue_condition_.notify_one();
26 }
27 
28 } // namespace flutter
std::chrono::steady_clock::time_point TaskTimePoint
Definition: event_loop.h:50
Definition: ref_ptr.h:252
HeadlessEventLoop(std::thread::id main_thread_id, const TaskExpiredCallback &on_task_expired)
std::function< void(const FlutterTask *)> TaskExpiredCallback
Definition: event_loop.h:22
std::mutex & GetTaskQueueMutex()
Definition: event_loop.h:58
int32_t id