Flutter Engine
flutter::testing::TestSwitchableGLContext Class Reference

The renderer context used for testing. More...

#include <gl_context_switch_test.h>

Inheritance diagram for flutter::testing::TestSwitchableGLContext:
flutter::SwitchableGLContext

Public Member Functions

 TestSwitchableGLContext (int context)
 
 ~TestSwitchableGLContext () override
 
bool SetCurrent () override
 
bool RemoveCurrent () override
 
int GetContext ()
 
- Public Member Functions inherited from flutter::SwitchableGLContext
 SwitchableGLContext ()
 
virtual ~SwitchableGLContext ()
 
 FML_DISALLOW_COPY_AND_ASSIGN (SwitchableGLContext)
 

Static Public Member Functions

static int GetCurrentContext ()
 
static void SetCurrentContext (int context)
 

Detailed Description

The renderer context used for testing.

Definition at line 21 of file gl_context_switch_test.h.

Constructor & Destructor Documentation

◆ TestSwitchableGLContext()

flutter::testing::TestSwitchableGLContext::TestSwitchableGLContext ( int  context)

Definition at line 16 of file gl_context_switch_test.cc.

References ~TestSwitchableGLContext().

17  : context_(context){};

◆ ~TestSwitchableGLContext()

flutter::testing::TestSwitchableGLContext::~TestSwitchableGLContext ( )
overridedefault

Referenced by TestSwitchableGLContext().

Member Function Documentation

◆ GetContext()

int flutter::testing::TestSwitchableGLContext::GetContext ( )

Definition at line 31 of file gl_context_switch_test.cc.

31  {
32  return context_;
33 };

◆ GetCurrentContext()

int flutter::testing::TestSwitchableGLContext::GetCurrentContext ( )
static

Definition at line 35 of file gl_context_switch_test.cc.

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

35  {
36  return *(current_context.get());
37 };
FML_THREAD_LOCAL fml::ThreadLocalUniquePtr< int > current_context

◆ RemoveCurrent()

bool flutter::testing::TestSwitchableGLContext::RemoveCurrent ( )
overridevirtual

Implements flutter::SwitchableGLContext.

Definition at line 26 of file gl_context_switch_test.cc.

References SetCurrentContext().

26  {
28  return true;
29 };

◆ SetCurrent()

bool flutter::testing::TestSwitchableGLContext::SetCurrent ( )
overridevirtual

Implements flutter::SwitchableGLContext.

Definition at line 21 of file gl_context_switch_test.cc.

References SetCurrentContext().

21  {
22  SetCurrentContext(context_);
23  return true;
24 };

◆ SetCurrentContext()

void flutter::testing::TestSwitchableGLContext::SetCurrentContext ( int  context)
static

Set the current context

This is to mimic how other programs outside flutter sets the context.

Definition at line 39 of file gl_context_switch_test.cc.

Referenced by RemoveCurrent(), and SetCurrent().

39  {
40  current_context.reset(new int(context));
41 };
FML_THREAD_LOCAL fml::ThreadLocalUniquePtr< int > current_context

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