Flutter Impeller
impeller::UniqueHandleGLES Class Reference

A unique handle to an OpenGL object. The collection of this handle scheduled the destruction of the associated OpenGL object in the reactor. More...

#include <unique_handle_gles.h>

Public Member Functions

 UniqueHandleGLES ()=default
 
 UniqueHandleGLES (std::shared_ptr< ReactorGLES > reactor, HandleType type)
 
 UniqueHandleGLES (std::shared_ptr< ReactorGLES > reactor, HandleGLES handle)
 
 ~UniqueHandleGLES ()
 
 UniqueHandleGLES (UniqueHandleGLES &&)
 
UniqueHandleGLES & operator= (UniqueHandleGLES &&)
 
 UniqueHandleGLES (const UniqueHandleGLES &)=delete
 
UniqueHandleGLES & operator= (const UniqueHandleGLES &)=delete
 
const HandleGLES & Get () const
 
bool IsValid () const
 
void Reset ()
 Collect the managed handle and replace it with a dead handle. More...
 
HandleGLES Release ()
 Release ownership of the handle. More...
 

Static Public Member Functions

static UniqueHandleGLES MakeUntracked (std::shared_ptr< ReactorGLES > reactor, HandleType type)
 

Detailed Description

A unique handle to an OpenGL object. The collection of this handle scheduled the destruction of the associated OpenGL object in the reactor.

Definition at line 18 of file unique_handle_gles.h.

Constructor & Destructor Documentation

◆ UniqueHandleGLES() [1/5]

impeller::UniqueHandleGLES::UniqueHandleGLES ( )
default

Referenced by MakeUntracked().

◆ UniqueHandleGLES() [2/5]

impeller::UniqueHandleGLES::UniqueHandleGLES ( std::shared_ptr< ReactorGLES >  reactor,
HandleType  type 
)

Definition at line 11 of file unique_handle_gles.cc.

13  : reactor_(std::move(reactor)) {
14  if (reactor_) {
15  handle_ = reactor_->CreateHandle(type);
16  }
17 }
std::shared_ptr< ReactorGLES > reactor

◆ UniqueHandleGLES() [3/5]

impeller::UniqueHandleGLES::UniqueHandleGLES ( std::shared_ptr< ReactorGLES >  reactor,
HandleGLES  handle 
)

Definition at line 28 of file unique_handle_gles.cc.

30  : reactor_(std::move(reactor)), handle_(handle) {}

◆ ~UniqueHandleGLES()

impeller::UniqueHandleGLES::~UniqueHandleGLES ( )

Definition at line 32 of file unique_handle_gles.cc.

32  {
33  CollectHandle();
34 }

◆ UniqueHandleGLES() [4/5]

impeller::UniqueHandleGLES::UniqueHandleGLES ( UniqueHandleGLES &&  other)

Definition at line 63 of file unique_handle_gles.cc.

63  {
64  std::swap(reactor_, other.reactor_);
65  std::swap(handle_, other.handle_);
66 }

◆ UniqueHandleGLES() [5/5]

impeller::UniqueHandleGLES::UniqueHandleGLES ( const UniqueHandleGLES &  )
delete

Member Function Documentation

◆ Get()

const HandleGLES & impeller::UniqueHandleGLES::Get ( ) const

◆ IsValid()

bool impeller::UniqueHandleGLES::IsValid ( ) const

Definition at line 46 of file unique_handle_gles.cc.

46  {
47  return !handle_.IsDead();
48 }
constexpr bool IsDead() const
Determines if the handle is dead.
Definition: handle_gles.h:58

References impeller::HandleGLES::IsDead().

Referenced by impeller::TextureGLES::Bind(), impeller::TextureGLES::GetSyncFence(), and impeller::TextureGLES::SetFence().

◆ MakeUntracked()

UniqueHandleGLES impeller::UniqueHandleGLES::MakeUntracked ( std::shared_ptr< ReactorGLES >  reactor,
HandleType  type 
)
static

Definition at line 20 of file unique_handle_gles.cc.

22  {
23  FML_DCHECK(reactor);
24  HandleGLES handle = reactor->CreateUntrackedHandle(type);
25  return UniqueHandleGLES(std::move(reactor), handle);
26 }

References reactor, and UniqueHandleGLES().

Referenced by impeller::testing::TEST().

◆ operator=() [1/2]

UniqueHandleGLES& impeller::UniqueHandleGLES::operator= ( const UniqueHandleGLES &  )
delete

◆ operator=() [2/2]

UniqueHandleGLES & impeller::UniqueHandleGLES::operator= ( UniqueHandleGLES &&  other)

Definition at line 68 of file unique_handle_gles.cc.

68  {
69  if (this != &other) {
70  Reset();
71  std::swap(reactor_, other.reactor_);
72  std::swap(handle_, other.handle_);
73  }
74  return *this;
75 }
void Reset()
Collect the managed handle and replace it with a dead handle.

References Reset().

◆ Release()

HandleGLES impeller::UniqueHandleGLES::Release ( )

Release ownership of the handle.

Definition at line 56 of file unique_handle_gles.cc.

56  {
57  reactor_.reset();
58  HandleGLES old_handle = handle_;
59  handle_ = HandleGLES::DeadHandle();
60  return old_handle;
61 }
static HandleGLES DeadHandle()
Creates a dead handle.
Definition: handle_gles.h:49

References impeller::HandleGLES::DeadHandle().

Referenced by impeller::TextureGLES::Leak().

◆ Reset()

void impeller::UniqueHandleGLES::Reset ( )

Collect the managed handle and replace it with a dead handle.

Definition at line 50 of file unique_handle_gles.cc.

50  {
51  CollectHandle();
52  reactor_.reset();
53  handle_ = HandleGLES::DeadHandle();
54 }

References impeller::HandleGLES::DeadHandle().

Referenced by impeller::TextureGLES::Bind(), and operator=().


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