Flutter Engine
flutter::testing::EmbedderTestContextGL Class Reference

#include <embedder_test_context_gl.h>

Inheritance diagram for flutter::testing::EmbedderTestContextGL:
flutter::testing::EmbedderTestContext

Public Types

using GLGetFBOCallback = std::function< void(FlutterFrameInfo frame_info)>
 
using GLPresentCallback = std::function< void(uint32_t fbo_id)>
 

Public Member Functions

 EmbedderTestContextGL (std::string assets_path="")
 
 ~EmbedderTestContextGL () override
 
size_t GetSurfacePresentCount () const override
 
void SetGLGetFBOCallback (GLGetFBOCallback callback)
 Sets a callback that will be invoked (on the raster task runner) when the engine asks the embedder for a new FBO ID at the updated size. More...
 
uint32_t GetWindowFBOId () const
 
void SetGLPresentCallback (GLPresentCallback callback)
 Sets a callback that will be invoked (on the raster task runner) when the engine presents an fbo that was given by the embedder. More...
 
- Public Member Functions inherited from flutter::testing::EmbedderTestContext
 EmbedderTestContext (std::string assets_path="")
 
virtual ~EmbedderTestContext ()
 
const std::string & GetAssetsPath () const
 
const fml::MappingGetVMSnapshotData () const
 
const fml::MappingGetVMSnapshotInstructions () const
 
const fml::MappingGetIsolateSnapshotData () const
 
const fml::MappingGetIsolateSnapshotInstructions () const
 
FlutterEngineAOTData GetAOTData () const
 
void SetRootSurfaceTransformation (SkMatrix matrix)
 
void AddIsolateCreateCallback (fml::closure closure)
 
void AddNativeCallback (const char *name, Dart_NativeFunction function)
 
void SetSemanticsNodeCallback (const SemanticsNodeCallback &update_semantics_node)
 
void SetSemanticsCustomActionCallback (const SemanticsActionCallback &semantics_custom_action)
 
void SetPlatformMessageCallback (const std::function< void(const FlutterPlatformMessage *)> &callback)
 
std::future< sk_sp< SkImage > > GetNextSceneImage ()
 
EmbedderTestCompositorGetCompositor ()
 

Protected Member Functions

virtual void SetupCompositor () override
 
- Protected Member Functions inherited from flutter::testing::EmbedderTestContext
void SetupAOTMappingsIfNecessary ()
 
void SetupAOTDataIfNecessary ()
 
void FireIsolateCreateCallbacks ()
 
void SetNativeResolver ()
 
FlutterTransformation GetRootSurfaceTransformation ()
 
void PlatformMessageCallback (const FlutterPlatformMessage *message)
 
void FireRootSurfacePresentCallbackIfPresent (const std::function< sk_sp< SkImage >(void)> &image_callback)
 
void SetNextSceneCallback (const NextSceneCallback &next_scene_callback)
 
 FML_DISALLOW_COPY_AND_ASSIGN (EmbedderTestContext)
 

Friends

class EmbedderConfigBuilder
 

Additional Inherited Members

- Protected Types inherited from flutter::testing::EmbedderTestContext
using NextSceneCallback = std::function< void(sk_sp< SkImage > image)>
 
- Static Protected Member Functions inherited from flutter::testing::EmbedderTestContext
static VoidCallback GetIsolateCreateCallbackHook ()
 
static FlutterUpdateSemanticsNodeCallback GetUpdateSemanticsNodeCallbackHook ()
 
static FlutterUpdateSemanticsCustomActionCallback GetUpdateSemanticsCustomActionCallbackHook ()
 
static FlutterComputePlatformResolvedLocaleCallback GetComputePlatformResolvedLocaleCallbackHook ()
 
- Protected Attributes inherited from flutter::testing::EmbedderTestContext
std::string assets_path_
 
ELFAOTSymbols aot_symbols_
 
std::unique_ptr< fml::Mappingvm_snapshot_data_
 
std::unique_ptr< fml::Mappingvm_snapshot_instructions_
 
std::unique_ptr< fml::Mappingisolate_snapshot_data_
 
std::unique_ptr< fml::Mappingisolate_snapshot_instructions_
 
UniqueAOTData aot_data_
 
std::vector< fml::closureisolate_create_callbacks_
 
std::shared_ptr< TestDartNativeResolvernative_resolver_
 
SemanticsNodeCallback update_semantics_node_callback_
 
SemanticsActionCallback update_semantics_custom_action_callback_
 
std::function< void(const FlutterPlatformMessage *)> platform_message_callback_
 
std::unique_ptr< EmbedderTestCompositorcompositor_
 
NextSceneCallback next_scene_callback_
 
SkMatrix root_surface_transformation_
 

Detailed Description

Definition at line 14 of file embedder_test_context_gl.h.

Member Typedef Documentation

◆ GLGetFBOCallback

◆ GLPresentCallback

Constructor & Destructor Documentation

◆ EmbedderTestContextGL()

flutter::testing::EmbedderTestContextGL::EmbedderTestContextGL ( std::string  assets_path = "")

Definition at line 19 of file embedder_test_context_gl.cc.

20  : EmbedderTestContext(assets_path) {}
EmbedderTestContext(std::string assets_path="")

◆ ~EmbedderTestContextGL()

flutter::testing::EmbedderTestContextGL::~EmbedderTestContextGL ( )
override

Definition at line 22 of file embedder_test_context_gl.cc.

References flutter::testing::EmbedderTestContext::FireRootSurfacePresentCallbackIfPresent(), FML_CHECK, and SetGLGetFBOCallback().

22  {
23  SetGLGetFBOCallback(nullptr);
24 }
void SetGLGetFBOCallback(GLGetFBOCallback callback)
Sets a callback that will be invoked (on the raster task runner) when the engine asks the embedder fo...

Member Function Documentation

◆ GetSurfacePresentCount()

size_t flutter::testing::EmbedderTestContextGL::GetSurfacePresentCount ( ) const
overridevirtual

Implements flutter::testing::EmbedderTestContext.

Definition at line 102 of file embedder_test_context_gl.cc.

102  {
103  return gl_surface_present_count_;
104 }

◆ GetWindowFBOId()

uint32_t flutter::testing::EmbedderTestContextGL::GetWindowFBOId ( ) const

Definition at line 106 of file embedder_test_context_gl.cc.

References FML_CHECK.

106  {
107  FML_CHECK(gl_surface_);
108  return gl_surface_->GetWindowFBOId();
109 }
#define FML_CHECK(condition)
Definition: logging.h:68

◆ SetGLGetFBOCallback()

void flutter::testing::EmbedderTestContextGL::SetGLGetFBOCallback ( GLGetFBOCallback  callback)

Sets a callback that will be invoked (on the raster task runner) when the engine asks the embedder for a new FBO ID at the updated size.

Attention
The callback will be invoked on the raster task runner. The callback can be set on the tests host thread.
Parameters
[in]callbackThe callback to set. The previous callback will be un-registered.

Definition at line 65 of file embedder_test_context_gl.cc.

Referenced by ~EmbedderTestContextGL().

65  {
66  std::scoped_lock lock(gl_callback_mutex_);
67  gl_get_fbo_callback_ = callback;
68 }

◆ SetGLPresentCallback()

void flutter::testing::EmbedderTestContextGL::SetGLPresentCallback ( GLPresentCallback  callback)

Sets a callback that will be invoked (on the raster task runner) when the engine presents an fbo that was given by the embedder.

Attention
The callback will be invoked on the raster task runner. The callback can be set on the tests host thread.
Parameters
[in]callbackThe callback to set. The previous callback will be un-registered.

Definition at line 70 of file embedder_test_context_gl.cc.

References FML_CHECK, name, fml::size(), and FlutterFrameInfo::size.

70  {
71  std::scoped_lock lock(gl_callback_mutex_);
72  gl_present_callback_ = callback;
73 }

◆ SetupCompositor()

void flutter::testing::EmbedderTestContextGL::SetupCompositor ( )
overrideprotectedvirtual

Implements flutter::testing::EmbedderTestContext.

Definition at line 111 of file embedder_test_context_gl.cc.

References flutter::testing::EmbedderTestContext::compositor_, and FML_CHECK.

111  {
112  FML_CHECK(!compositor_) << "Already ssetup a compositor in this context.";
113  FML_CHECK(gl_surface_)
114  << "Setup the GL surface before setting up a compositor.";
115  compositor_ = std::make_unique<EmbedderTestCompositorGL>(
116  gl_surface_->GetSurfaceSize(), gl_surface_->GetGrContext());
117 }
std::unique_ptr< EmbedderTestCompositor > compositor_
#define FML_CHECK(condition)
Definition: logging.h:68

Friends And Related Function Documentation

◆ EmbedderConfigBuilder

friend class EmbedderConfigBuilder
friend

Definition at line 58 of file embedder_test_context_gl.h.


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