Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Friends | List of all members
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 GLPopulateExistingDamageCallback = std::function< void(intptr_t id, FlutterDamage *existing_damage)>
 
using GLPresentCallback = std::function< void(FlutterPresentInfo present_info)>
 

Public Member Functions

 EmbedderTestContextGL (std::string assets_path="")
 
 ~EmbedderTestContextGL () override
 
size_t GetSurfacePresentCount () const override
 
EmbedderTestContextType GetContextType () 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.
 
void SetGLPopulateExistingDamageCallback (GLPopulateExistingDamageCallback callback)
 
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.
 
void GLPopulateExistingDamage (const intptr_t id, FlutterDamage *existing_damage)
 
void * GLGetProcAddress (const char *name)
 
- 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 (const fml::closure &closure)
 
void SetSemanticsUpdateCallback2 (SemanticsUpdateCallback2 update_semantics)
 
void SetSemanticsUpdateCallback (SemanticsUpdateCallback update_semantics)
 
void AddNativeCallback (const char *name, Dart_NativeFunction function)
 
void SetSemanticsNodeCallback (SemanticsNodeCallback update_semantics_node)
 
void SetSemanticsCustomActionCallback (SemanticsActionCallback semantics_custom_action)
 
void SetPlatformMessageCallback (const std::function< void(const FlutterPlatformMessage *)> &callback)
 
void SetLogMessageCallback (const LogMessageCallback &log_message_callback)
 
void SetChannelUpdateCallback (const ChannelUpdateCallback &callback)
 
std::future< sk_sp< SkImage > > GetNextSceneImage ()
 
EmbedderTestCompositorGetCompositor ()
 
void SetVsyncCallback (std::function< void(intptr_t)> callback)
 
void RunVsyncCallback (intptr_t baton)
 

Protected Member Functions

virtual void SetupCompositor () override
 
- Protected Member Functions inherited from flutter::testing::EmbedderTestContext
FlutterUpdateSemanticsCallback2 GetUpdateSemanticsCallback2Hook ()
 
FlutterUpdateSemanticsCallback GetUpdateSemanticsCallbackHook ()
 
FlutterUpdateSemanticsNodeCallback GetUpdateSemanticsNodeCallbackHook ()
 
FlutterUpdateSemanticsCustomActionCallback GetUpdateSemanticsCustomActionCallbackHook ()
 
FlutterChannelUpdateCallback GetChannelUpdateCallbackHook ()
 
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)
 

Private Member Functions

void SetupSurface (SkISize surface_size) override
 

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 FlutterLogMessageCallback GetLogMessageCallbackHook ()
 
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_
 
SemanticsUpdateCallback2 update_semantics_callback2_
 
SemanticsUpdateCallback update_semantics_callback_
 
SemanticsNodeCallback update_semantics_node_callback_
 
SemanticsActionCallback update_semantics_custom_action_callback_
 
ChannelUpdateCallback channel_update_callback_
 
std::function< void(const FlutterPlatformMessage *)> platform_message_callback_
 
LogMessageCallback log_message_callback_
 
std::unique_ptr< EmbedderTestCompositorcompositor_
 
NextSceneCallback next_scene_callback_
 
SkMatrix root_surface_transformation_
 
std::function< void(intptr_t)> vsync_callback_ = nullptr
 

Detailed Description

Definition at line 14 of file embedder_test_context_gl.h.

Member Typedef Documentation

◆ GLGetFBOCallback

Definition at line 16 of file embedder_test_context_gl.h.

◆ GLPopulateExistingDamageCallback

using flutter::testing::EmbedderTestContextGL::GLPopulateExistingDamageCallback = std::function<void(intptr_t id, FlutterDamage* existing_damage)>

Definition at line 17 of file embedder_test_context_gl.h.

◆ GLPresentCallback

Definition at line 19 of file embedder_test_context_gl.h.

Constructor & Destructor Documentation

◆ EmbedderTestContextGL()

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

Definition at line 22 of file embedder_test_context_gl.cc.

23 : EmbedderTestContext(std::move(assets_path)) {}
EmbedderTestContext(std::string assets_path="")

◆ ~EmbedderTestContextGL()

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

Definition at line 25 of file embedder_test_context_gl.cc.

25 {
26 SetGLGetFBOCallback(nullptr);
27}
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

◆ GetContextType()

EmbedderTestContextType flutter::testing::EmbedderTestContextGL::GetContextType ( ) const
overridevirtual

◆ GetSurfacePresentCount()

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

Implements flutter::testing::EmbedderTestContext.

Definition at line 123 of file embedder_test_context_gl.cc.

123 {
124 return gl_surface_present_count_;
125}

◆ GetWindowFBOId()

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

Definition at line 131 of file embedder_test_context_gl.cc.

131 {
132 FML_CHECK(gl_surface_);
133 return gl_surface_->GetWindowFBOId();
134}
#define FML_CHECK(condition)
Definition logging.h:85

◆ GLGetProcAddress()

void * flutter::testing::EmbedderTestContextGL::GLGetProcAddress ( const char *  name)

Definition at line 118 of file embedder_test_context_gl.cc.

118 {
119 FML_CHECK(gl_surface_) << "GL surface must be initialized.";
120 return gl_surface_->GetProcAddress(name);
121}
DEF_SWITCHES_START aot vmservice shared library name
Definition switches.h:32

◆ GLPopulateExistingDamage()

void flutter::testing::EmbedderTestContextGL::GLPopulateExistingDamage ( const intptr_t  id,
FlutterDamage existing_damage 
)

Definition at line 97 of file embedder_test_context_gl.cc.

99 {
100 FML_CHECK(gl_surface_) << "GL surface must be initialized.";
101
103 {
104 std::scoped_lock lock(gl_callback_mutex_);
105 callback = gl_populate_existing_damage_callback_;
106 }
107
108 if (callback) {
109 callback(id, existing_damage);
110 }
111}
std::function< void(intptr_t id, FlutterDamage *existing_damage)> GLPopulateExistingDamageCallback
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ 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 64 of file embedder_test_context_gl.cc.

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

◆ SetGLPopulateExistingDamageCallback()

void flutter::testing::EmbedderTestContextGL::SetGLPopulateExistingDamageCallback ( GLPopulateExistingDamageCallback  callback)

Definition at line 69 of file embedder_test_context_gl.cc.

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

◆ 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 75 of file embedder_test_context_gl.cc.

75 {
76 std::scoped_lock lock(gl_callback_mutex_);
77 gl_present_callback_ = std::move(callback);
78}

◆ SetupCompositor()

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

Implements flutter::testing::EmbedderTestContext.

Definition at line 136 of file embedder_test_context_gl.cc.

136 {
137 FML_CHECK(!compositor_) << "Already set up a compositor in this context.";
138 FML_CHECK(gl_surface_)
139 << "Set up the GL surface before setting up a compositor.";
140 compositor_ = std::make_unique<EmbedderTestCompositorGL>(
141 gl_surface_->GetSurfaceSize(), gl_surface_->GetGrContext());
142 GLClearCurrent();
143}
std::unique_ptr< EmbedderTestCompositor > compositor_

◆ SetupSurface()

void flutter::testing::EmbedderTestContextGL::SetupSurface ( SkISize  surface_size)
overrideprivatevirtual

Implements flutter::testing::EmbedderTestContext.

Definition at line 29 of file embedder_test_context_gl.cc.

29 {
30 FML_CHECK(!gl_surface_);
31 gl_surface_ = std::make_unique<TestGLSurface>(surface_size);
32}

Friends And Related Symbol Documentation

◆ EmbedderConfigBuilder

friend class EmbedderConfigBuilder
friend

Definition at line 72 of file embedder_test_context_gl.h.


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