Flutter Impeller
surface_control_impl.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_TOOLKIT_ANDROID_SURFACE_CONTROL_IMPL_H_
6 #define FLUTTER_IMPELLER_TOOLKIT_ANDROID_SURFACE_CONTROL_IMPL_H_
7 
8 #include "flutter/fml/unique_object.h"
10 
11 namespace impeller::android {
12 
13 class SurfaceControlImpl final : public SurfaceControl {
14  public:
15  virtual ~SurfaceControlImpl();
16 
18 
20 
21  SurfaceControlImpl(ANativeWindow* window, const char* debug_name);
22 
23  bool IsValid() const override;
24 
25  ASurfaceControl* GetHandle() const override;
26 
27  bool RemoveFromParent() const override;
28 
29  private:
30  friend class SurfaceControl;
31 
32  struct UniqueASurfaceControlTraits {
33  static ASurfaceControl* InvalidValue() { return nullptr; }
34 
35  static bool IsValid(ASurfaceControl* value) {
36  return value != InvalidValue();
37  }
38 
39  static void Free(ASurfaceControl* value) {
40  GetProcTable().ASurfaceControl_release(value);
41  }
42  };
43 
44  fml::UniqueObject<ASurfaceControl*, UniqueASurfaceControlTraits> control_;
45 };
46 
47 } // namespace impeller::android
48 
49 #endif // FLUTTER_IMPELLER_TOOLKIT_ANDROID_SURFACE_CONTROL_IMPL_H_
A wrapper for ASurfaceControl. https://developer.android.com/ndk/reference/group/native-activity#asur...
SurfaceControlImpl & operator=(const SurfaceControlImpl &)=delete
SurfaceControlImpl(const SurfaceControlImpl &)=delete
ASurfaceControl * GetHandle() const override
bool RemoveFromParent() const override
Remove the surface control from the hierarchy of nodes presented by the system compositor.
int32_t value
const ProcTable & GetProcTable()
Definition: proc_table.cc:12