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_LIB_UI_PAINTING_ENGINE_LAYER_H_ |
6 | #define FLUTTER_LIB_UI_PAINTING_ENGINE_LAYER_H_ |
7 | |
8 | #include "flutter/flow/layers/container_layer.h" |
9 | #include "flutter/lib/ui/dart_wrapper.h" |
10 | |
11 | namespace flutter { |
12 | |
13 | class EngineLayer; |
14 | |
15 | class EngineLayer : public RefCountedDartWrappable<EngineLayer> { |
16 | DEFINE_WRAPPERTYPEINFO(); |
17 | |
18 | public: |
19 | ~EngineLayer() override; |
20 | |
21 | static void MakeRetained(Dart_Handle dart_handle, |
22 | std::shared_ptr<flutter::ContainerLayer> layer) { |
23 | auto engine_layer = fml::MakeRefCounted<EngineLayer>(args&: layer); |
24 | engine_layer->AssociateWithDartWrapper(wrappable: dart_handle); |
25 | } |
26 | |
27 | void dispose(); |
28 | |
29 | std::shared_ptr<flutter::ContainerLayer> Layer() const { return layer_; } |
30 | |
31 | private: |
32 | explicit EngineLayer(std::shared_ptr<flutter::ContainerLayer> layer); |
33 | std::shared_ptr<flutter::ContainerLayer> layer_; |
34 | |
35 | FML_FRIEND_MAKE_REF_COUNTED(EngineLayer); |
36 | }; |
37 | |
38 | } // namespace flutter |
39 | |
40 | #endif // FLUTTER_LIB_UI_PAINTING_ENGINE_LAYER_H_ |
41 |