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 #pragma once
6 
7 #include <condition_variable>
8 #include <memory>
9 #include <thread>
10 #include <vector>
11 
12 #include "flutter/fml/closure.h"
13 #include "flutter/fml/macros.h"
14 #include "impeller/base/thread.h"
18 
19 namespace impeller {
20 
21 class ContextVK;
22 class WaitSetEntry;
23 
24 using WaitSet = std::vector<std::shared_ptr<WaitSetEntry>>;
25 
27  public:
29 
30  bool IsValid() const;
31 
32  void Terminate();
33 
34  bool AddFence(vk::UniqueFence fence, const fml::closure& callback);
35 
36  private:
37  friend class ContextVK;
38 
39  std::weak_ptr<DeviceHolder> device_holder_;
40  std::unique_ptr<std::thread> waiter_thread_;
41  std::mutex wait_set_mutex_;
42  std::condition_variable wait_set_cv_;
43  WaitSet wait_set_;
44  bool terminate_ = false;
45 
46  explicit FenceWaiterVK(std::weak_ptr<DeviceHolder> device_holder);
47 
48  void Main();
49 
50  bool Wait();
51  void WaitUntilEmpty();
52 
53  FML_DISALLOW_COPY_AND_ASSIGN(FenceWaiterVK);
54 };
55 
56 } // namespace impeller
impeller::WaitSet
std::vector< std::shared_ptr< WaitSetEntry > > WaitSet
Definition: fence_waiter_vk.h:24
shared_object_vk.h
device_holder.h
impeller::FenceWaiterVK::AddFence
bool AddFence(vk::UniqueFence fence, const fml::closure &callback)
Definition: fence_waiter_vk.cc:59
impeller::Main
bool Main(const fml::CommandLine &command_line)
Definition: blobcat_main.cc:13
vk.h
impeller::FenceWaiterVK::IsValid
bool IsValid() const
impeller::ContextVK
Definition: context_vk.h:36
impeller::FenceWaiterVK::Terminate
void Terminate()
Definition: fence_waiter_vk.cc:202
impeller::FenceWaiterVK::~FenceWaiterVK
~FenceWaiterVK()
Definition: fence_waiter_vk.cc:54
impeller::FenceWaiterVK
Definition: fence_waiter_vk.h:26
thread.h
impeller
Definition: aiks_context.cc:10