Flutter Engine
The Flutter Engine
fence_waiter_vk.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_IMPELLER_RENDERER_BACKEND_VULKAN_FENCE_WAITER_VK_H_
6#define FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_FENCE_WAITER_VK_H_
7
8#include <condition_variable>
9#include <memory>
10#include <thread>
11#include <vector>
12
13#include "flutter/fml/closure.h"
15
16namespace impeller {
17
18class ContextVK;
19class WaitSetEntry;
20
21using WaitSet = std::vector<std::shared_ptr<WaitSetEntry>>;
22
24 public:
26
27 bool IsValid() const;
28
29 void Terminate();
30
31 bool AddFence(vk::UniqueFence fence, const fml::closure& callback);
32
33 private:
34 friend class ContextVK;
35
36 std::weak_ptr<DeviceHolderVK> device_holder_;
37 std::unique_ptr<std::thread> waiter_thread_;
38 std::mutex wait_set_mutex_;
39 std::condition_variable wait_set_cv_;
40 WaitSet wait_set_;
41 bool terminate_ = false;
42
43 explicit FenceWaiterVK(std::weak_ptr<DeviceHolderVK> device_holder);
44
45 void Main();
46
47 bool Wait();
48 void WaitUntilEmpty();
49
50 FenceWaiterVK(const FenceWaiterVK&) = delete;
51
52 FenceWaiterVK& operator=(const FenceWaiterVK&) = delete;
53};
54
55} // namespace impeller
56
57#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_FENCE_WAITER_VK_H_
bool AddFence(vk::UniqueFence fence, const fml::closure &callback)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
int Main(int argc, char **argv)
Definition: benchmarking.cc:14
std::function< void()> closure
Definition: closure.h:14
std::vector< std::shared_ptr< WaitSetEntry > > WaitSet