| Flutter Impeller |

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 "impeller/renderer/backend/vulkan/device_holder_vk.h"
15
16 namespace impeller {
17
18 class ContextVK;
19 class WaitSetEntry;
20
21 using WaitSet = std::vector<std::shared_ptr<WaitSetEntry>>;
22
23 class FenceWaiterVK {
24 public:
25 ~FenceWaiterVK();
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_
impeller::WaitSet
std::vector< std::shared_ptr< WaitSetEntry > > WaitSet
Definition: fence_waiter_vk.h:21
impeller::FenceWaiterVK::AddFence
bool AddFence(vk::UniqueFence fence, const fml::closure &callback)
Definition: fence_waiter_vk.cc:65
impeller::compiler::Main
bool Main(const fml::CommandLine &command_line)
Definition: impellerc_main.cc:234
device_holder_vk.h
impeller::FenceWaiterVK::IsValid
bool IsValid() const
impeller::ContextVK
Definition: context_vk.h:64
impeller::FenceWaiterVK::Terminate
void Terminate()
Definition: fence_waiter_vk.cc:207
impeller::FenceWaiterVK::~FenceWaiterVK
~FenceWaiterVK()
Definition: fence_waiter_vk.cc:60
impeller::FenceWaiterVK
Definition: fence_waiter_vk.h:23
impeller
Definition: allocation.cc:12