Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
impeller::android::SurfaceControlImpl Class Referencefinal

#include <surface_control_impl.h>

Inheritance diagram for impeller::android::SurfaceControlImpl:
impeller::android::SurfaceControl

Public Member Functions

virtual ~SurfaceControlImpl ()
 
 SurfaceControlImpl (const SurfaceControlImpl &)=delete
 
SurfaceControlImploperator= (const SurfaceControlImpl &)=delete
 
 SurfaceControlImpl (ANativeWindow *window, const char *debug_name)
 
bool IsValid () const override
 
ASurfaceControl * GetHandle () const override
 
bool RemoveFromParent () const override
 Remove the surface control from the hierarchy of nodes presented by the system compositor.
 
- Public Member Functions inherited from impeller::android::SurfaceControl
virtual ~SurfaceControl ()=default
 Removes the surface control from the presentation hierarchy managed by the system compositor and release the client side reference to the control. At this point, it may be collected when the compositor is also done using it.
 

Friends

class SurfaceControl
 

Additional Inherited Members

- Static Public Member Functions inherited from impeller::android::SurfaceControl
static bool IsAvailableOnPlatform ()
 
static std::unique_ptr< SurfaceControlCreate (ANativeWindow *window, const char *debug_name=nullptr)
 Creates a new surface control and adds it as a child of the given window.
 

Detailed Description

Definition at line 13 of file surface_control_impl.h.

Constructor & Destructor Documentation

◆ ~SurfaceControlImpl()

impeller::android::SurfaceControlImpl::~SurfaceControlImpl ( )
virtual

Definition at line 25 of file surface_control_impl.cc.

25 {
26 if (IsValid() && !RemoveFromParent()) {
27 VALIDATION_LOG << "Surface control could not be removed from its parent. "
28 "Expect a leak.";
29 }
30}
bool RemoveFromParent() const override
Remove the surface control from the hierarchy of nodes presented by the system compositor.
#define VALIDATION_LOG
Definition validation.h:91

References IsValid(), RemoveFromParent(), and VALIDATION_LOG.

◆ SurfaceControlImpl() [1/2]

impeller::android::SurfaceControlImpl::SurfaceControlImpl ( const SurfaceControlImpl )
delete

◆ SurfaceControlImpl() [2/2]

impeller::android::SurfaceControlImpl::SurfaceControlImpl ( ANativeWindow window,
const char *  debug_name 
)

Definition at line 12 of file surface_control_impl.cc.

13 {
14 if (window == nullptr) {
15 VALIDATION_LOG << "Parent window of surface was null.";
16 return;
17 }
18 if (debug_name == nullptr) {
19 debug_name = "Impeller Layer";
20 }
21 control_.reset(
22 GetProcTable().ASurfaceControl_createFromWindow(window, debug_name));
23}
void reset(const T &value=Traits::InvalidValue())
GLFWwindow * window
Definition main.cc:60
const ProcTable & GetProcTable()
Definition proc_table.cc:12

References impeller::android::GetProcTable(), fml::UniqueObject< T, Traits >::reset(), VALIDATION_LOG, and window.

Member Function Documentation

◆ GetHandle()

ASurfaceControl * impeller::android::SurfaceControlImpl::GetHandle ( ) const
overridevirtual

Implements impeller::android::SurfaceControl.

Definition at line 36 of file surface_control_impl.cc.

36 {
37 return control_.get();
38}
const T & get() const

References fml::UniqueObject< T, Traits >::get().

◆ IsValid()

bool impeller::android::SurfaceControlImpl::IsValid ( ) const
overridevirtual

Implements impeller::android::SurfaceControl.

Definition at line 32 of file surface_control_impl.cc.

32 {
33 return control_.is_valid();
34}
bool is_valid() const

References fml::UniqueObject< T, Traits >::is_valid().

Referenced by RemoveFromParent(), and ~SurfaceControlImpl().

◆ operator=()

SurfaceControlImpl & impeller::android::SurfaceControlImpl::operator= ( const SurfaceControlImpl )
delete

◆ RemoveFromParent()

bool impeller::android::SurfaceControlImpl::RemoveFromParent ( ) const
overridevirtual

Remove the surface control from the hierarchy of nodes presented by the system compositor.

This is called implicitly when the surface control is collected.

Returns
true If the control will be removed from the hierarchy of nodes presented by the system compositor.

Implements impeller::android::SurfaceControl.

Definition at line 40 of file surface_control_impl.cc.

40 {
41 if (!IsValid()) {
42 return false;
43 }
44 SurfaceTransaction transaction;
45 if (!transaction.SetParent(*this, nullptr)) {
46 return false;
47 }
48 return transaction.Apply();
49}

References impeller::android::SurfaceTransaction::Apply(), IsValid(), and impeller::android::SurfaceTransaction::SetParent().

Referenced by ~SurfaceControlImpl().

Friends And Related Symbol Documentation

◆ SurfaceControl

friend class SurfaceControl
friend

Definition at line 30 of file surface_control_impl.h.


The documentation for this class was generated from the following files: