Flutter Engine
 
Loading...
Searching...
No Matches
impeller::glvk::AutoTrampolineContext Class Referencefinal

An RAII object that makes the trampolines EGL context current when constructed and clears the EGL binding on destruction. More...

#include <trampoline.h>

Public Member Functions

 AutoTrampolineContext (const Trampoline &trampoline)
 Constructs a new instance and makes the trampolines EGL context current on the calling thread.
 
 ~AutoTrampolineContext ()
 Destroys the object and clears the previous EGL binding.
 
 AutoTrampolineContext (const AutoTrampolineContext &)=delete
 
AutoTrampolineContextoperator= (const AutoTrampolineContext &)=delete
 

Detailed Description

An RAII object that makes the trampolines EGL context current when constructed and clears the EGL binding on destruction.

Definition at line 127 of file trampoline.h.

Constructor & Destructor Documentation

◆ AutoTrampolineContext() [1/2]

impeller::glvk::AutoTrampolineContext::AutoTrampolineContext ( const Trampoline trampoline)
explicit

Constructs a new instance and makes the trampolines EGL context current on the calling thread.

Parameters
[in]trampolineThe trampoline.

Definition at line 318 of file trampoline.cc.

319 : context_(trampoline.egl_context_.get()),
320 surface_(trampoline.egl_surface_.get()) {
321 if (!context_->IsCurrent() && !context_->MakeCurrent(*surface_)) {
322 VALIDATION_LOG << "Could not make context current.";
323 }
324};
bool IsCurrent() const
Definition context.cc:102
bool MakeCurrent(const Surface &surface) const
Make the context current on the calling thread. It is the caller responsibility to ensure that any co...
Definition context.cc:45
#define VALIDATION_LOG
Definition validation.h:91

References impeller::egl::Context::IsCurrent(), impeller::egl::Context::MakeCurrent(), and VALIDATION_LOG.

◆ ~AutoTrampolineContext()

impeller::glvk::AutoTrampolineContext::~AutoTrampolineContext ( )

Destroys the object and clears the previous EGL binding.

Definition at line 326 of file trampoline.cc.

326 {
327 if (!context_->ClearCurrent()) {
328 VALIDATION_LOG << "Could not clear current context.";
329 }
330}
bool ClearCurrent() const
Clear the thread association of this context.
Definition context.cc:61

References impeller::egl::Context::ClearCurrent(), and VALIDATION_LOG.

◆ AutoTrampolineContext() [2/2]

impeller::glvk::AutoTrampolineContext::AutoTrampolineContext ( const AutoTrampolineContext )
delete

Member Function Documentation

◆ operator=()

AutoTrampolineContext & impeller::glvk::AutoTrampolineContext::operator= ( const AutoTrampolineContext )
delete

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