| Flutter Impeller |

playground_impl_mtl.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_PLAYGROUND_BACKEND_METAL_PLAYGROUND_IMPL_MTL_H_
6 #define FLUTTER_IMPELLER_PLAYGROUND_BACKEND_METAL_PLAYGROUND_IMPL_MTL_H_
7
8 #include <memory>
9
10 #include "flutter/fml/concurrent_message_loop.h"
11 #include "flutter/fml/synchronization/sync_switch.h"
12 #include "impeller/playground/playground_impl.h"
13 #include "impeller/renderer/backend/metal/swapchain_transients_mtl.h"
14
15 namespace impeller {
16
17 // Forward declared to avoid objc in a C++ header.
18 class ContextMTL;
19
20 class PlaygroundImplMTL final : public PlaygroundImpl {
21 public:
22 explicit PlaygroundImplMTL(PlaygroundSwitches switches);
23
24 ~PlaygroundImplMTL();
25
26 fml::Status SetCapabilities(
27 const std::shared_ptr<Capabilities>& capabilities) override;
28
29 private:
30 struct Data;
31
32 static void DestroyWindowHandle(WindowHandle handle);
33 using UniqueHandle = std::unique_ptr<void, decltype(&DestroyWindowHandle)>;
34 UniqueHandle handle_;
35
36 // To ensure that ObjC stuff doesn't leak into C++ TUs.
37 std::unique_ptr<Data> data_;
38 std::shared_ptr<ContextMTL> context_;
39 std::shared_ptr<fml::ConcurrentMessageLoop> concurrent_loop_;
40 std::shared_ptr<SwapchainTransientsMTL> swapchain_transients_;
41 std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch_;
42
43 // |PlaygroundImpl|
44 std::shared_ptr<Context> GetContext() const override;
45
46 // |PlaygroundImpl|
47 WindowHandle GetWindowHandle() const override;
48
49 // |PlaygroundImpl|
50 std::unique_ptr<Surface> AcquireSurfaceFrame(
51 std::shared_ptr<Context> context) override;
52
53 PlaygroundImplMTL(const PlaygroundImplMTL&) = delete;
54
55 PlaygroundImplMTL& operator=(const PlaygroundImplMTL&) = delete;
56 };
57
58 } // namespace impeller
59
60 #endif // FLUTTER_IMPELLER_PLAYGROUND_BACKEND_METAL_PLAYGROUND_IMPL_MTL_H_
impeller::PlaygroundImpl
Definition: playground_impl.h:18
impeller::PlaygroundImpl::WindowHandle
void * WindowHandle
Definition: playground_impl.h:25
impeller::PlaygroundImplMTL
Definition: playground_impl_mtl.h:20
impeller::PlaygroundImplMTL::~PlaygroundImplMTL
~PlaygroundImplMTL()
impeller::PlaygroundImplMTL::SetCapabilities
fml::Status SetCapabilities(const std::shared_ptr< Capabilities > &capabilities) override
Definition: playground_impl_mtl.mm:135
impeller::PlaygroundImplMTL::PlaygroundImplMTL
PlaygroundImplMTL(PlaygroundSwitches switches)
Definition: playground_impl_mtl.mm:65
impeller
Definition: allocation.cc:12
playground_impl.h
impeller::PlaygroundImplMTL::Data
Definition: playground_impl_mtl.mm:32
impeller::PlaygroundSwitches
Definition: switches.h:16
swapchain_transients_mtl.h