Flutter Engine
engine_layer.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_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 tonic {
12 class DartLibraryNatives;
13 } // namespace tonic
14 
15 namespace flutter {
16 
17 class EngineLayer;
18 
19 class EngineLayer : public RefCountedDartWrappable<EngineLayer> {
21 
22  public:
23  ~EngineLayer() override;
24 
25  size_t GetAllocationSize() const override;
26 
28  std::shared_ptr<flutter::ContainerLayer> layer) {
29  return fml::MakeRefCounted<EngineLayer>(layer);
30  }
31 
32  static void MakeRetained(Dart_Handle dart_handle,
33  std::shared_ptr<flutter::ContainerLayer> layer) {
34  auto engine_layer = fml::MakeRefCounted<EngineLayer>(layer);
35  engine_layer->AssociateWithDartWrapper(dart_handle);
36  }
37 
38  static void RegisterNatives(tonic::DartLibraryNatives* natives);
39 
40  std::shared_ptr<flutter::ContainerLayer> Layer() const { return layer_; }
41 
42  private:
43  explicit EngineLayer(std::shared_ptr<flutter::ContainerLayer> layer);
44  std::shared_ptr<flutter::ContainerLayer> layer_;
45 
47 };
48 
49 } // namespace flutter
50 
51 #endif // FLUTTER_LIB_UI_PAINTING_ENGINE_LAYER_H_
std::shared_ptr< flutter::ContainerLayer > Layer() const
Definition: engine_layer.h:40
#define DEFINE_WRAPPERTYPEINFO()
#define FML_FRIEND_MAKE_REF_COUNTED(T)
Definition: ref_counted.h:131
static void MakeRetained(Dart_Handle dart_handle, std::shared_ptr< flutter::ContainerLayer > layer)
Definition: engine_layer.h:32
static fml::RefPtr< EngineLayer > MakeRetained(std::shared_ptr< flutter::ContainerLayer > layer)
Definition: engine_layer.h:27