Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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"
14#include "flutter/fml/macros.h"
19
20namespace impeller {
21
22class ContextVK;
23class WaitSetEntry;
24
25using WaitSet = std::vector<std::shared_ptr<WaitSetEntry>>;
26
28 public:
30
31 bool IsValid() const;
32
33 void Terminate();
34
35 bool AddFence(vk::UniqueFence fence, const fml::closure& callback);
36
37 private:
38 friend class ContextVK;
39
40 std::weak_ptr<DeviceHolderVK> device_holder_;
41 std::unique_ptr<std::thread> waiter_thread_;
42 std::mutex wait_set_mutex_;
43 std::condition_variable wait_set_cv_;
44 WaitSet wait_set_;
45 bool terminate_ = false;
46
47 explicit FenceWaiterVK(std::weak_ptr<DeviceHolderVK> device_holder);
48
49 void Main();
50
51 bool Wait();
52 void WaitUntilEmpty();
53
54 FenceWaiterVK(const FenceWaiterVK&) = delete;
55
56 FenceWaiterVK& operator=(const FenceWaiterVK&) = delete;
57};
58
59} // namespace impeller
60
61#endif // FLUTTER_IMPELLER_RENDERER_BACKEND_VULKAN_FENCE_WAITER_VK_H_
bool AddFence(vk::UniqueFence fence, const fml::closure &callback)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
std::function< void()> closure
Definition closure.h:14
std::vector< std::shared_ptr< WaitSetEntry > > WaitSet