Flutter Engine
The Flutter Engine
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"
13
14namespace impeller {
15
16// Forward declared to avoid objc in a C++ header.
17class ContextMTL;
18
19class PlaygroundImplMTL final : public PlaygroundImpl {
20 public:
21 explicit PlaygroundImplMTL(PlaygroundSwitches switches);
22
24
26 const std::shared_ptr<Capabilities>& capabilities) override;
27
28 private:
29 struct Data;
30
31 static void DestroyWindowHandle(WindowHandle handle);
32 using UniqueHandle = std::unique_ptr<void, decltype(&DestroyWindowHandle)>;
33 UniqueHandle handle_;
34
35 // To ensure that ObjC stuff doesn't leak into C++ TUs.
36 std::unique_ptr<Data> data_;
37 std::shared_ptr<ContextMTL> context_;
38 std::shared_ptr<fml::ConcurrentMessageLoop> concurrent_loop_;
39 std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch_;
40
41 // |PlaygroundImpl|
42 std::shared_ptr<Context> GetContext() const override;
43
44 // |PlaygroundImpl|
45 WindowHandle GetWindowHandle() const override;
46
47 // |PlaygroundImpl|
48 std::unique_ptr<Surface> AcquireSurfaceFrame(
49 std::shared_ptr<Context> context) override;
50
51 PlaygroundImplMTL(const PlaygroundImplMTL&) = delete;
52
53 PlaygroundImplMTL& operator=(const PlaygroundImplMTL&) = delete;
54};
55
56} // namespace impeller
57
58#endif // FLUTTER_IMPELLER_PLAYGROUND_BACKEND_METAL_PLAYGROUND_IMPL_MTL_H_
fml::Status SetCapabilities(const std::shared_ptr< Capabilities > &capabilities) override
PlaygroundImplMTL(PlaygroundSwitches switches)
SK_API GrDirectContext * GetContext(const SkImage *src)
fuchsia::ui::composition::ParentViewportWatcherHandle handle_