• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/lib/ui/dart_wrapper.h"
9 
10 #include "flutter/flow/layers/layer.h"
11 
12 namespace tonic {
13 class DartLibraryNatives;
14 }  // namespace tonic
15 
16 namespace flutter {
17 
18 class EngineLayer;
19 
20 class EngineLayer : public RefCountedDartWrappable<EngineLayer> {
21   DEFINE_WRAPPERTYPEINFO();
22 
23  public:
24   ~EngineLayer() override;
25 
26   size_t GetAllocationSize() override;
27 
MakeRetained(std::shared_ptr<flutter::ContainerLayer> layer)28   static fml::RefPtr<EngineLayer> MakeRetained(
29       std::shared_ptr<flutter::ContainerLayer> layer) {
30     return fml::MakeRefCounted<EngineLayer>(layer);
31   }
32 
33   static void RegisterNatives(tonic::DartLibraryNatives* natives);
34 
Layer()35   std::shared_ptr<flutter::ContainerLayer> Layer() const { return layer_; }
36 
37  private:
38   explicit EngineLayer(std::shared_ptr<flutter::ContainerLayer> layer);
39   std::shared_ptr<flutter::ContainerLayer> layer_;
40 
41   FML_FRIEND_MAKE_REF_COUNTED(EngineLayer);
42 };
43 
44 }  // namespace flutter
45 
46 #endif  // FLUTTER_LIB_UI_PAINTING_ENGINE_LAYER_H_
47