Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Friends | List of all members
flutter::testing::EmbedderTestContextMetal Class Reference

#include <embedder_test_context_metal.h>

Inheritance diagram for flutter::testing::EmbedderTestContextMetal:
flutter::testing::EmbedderTestContext

Public Types

using TestExternalTextureCallback = std::function< bool(int64_t texture_id, size_t w, size_t h, FlutterMetalExternalTexture *output)>
 
using NextDrawableCallback = std::function< FlutterMetalTexture(const FlutterFrameInfo *frame_info)>
 
using PresentCallback = std::function< bool(int64_t texture_id)>
 

Public Member Functions

 EmbedderTestContextMetal (std::string assets_path="")
 
 ~EmbedderTestContextMetal () override
 
EmbedderTestContextType GetContextType () const override
 
size_t GetSurfacePresentCount () const override
 
void SetupCompositor () override
 
void SetExternalTextureCallback (TestExternalTextureCallback external_texture_frame_callback)
 
void SetPresentCallback (PresentCallback present_callback)
 
bool Present (int64_t texture_id)
 
bool PopulateExternalTexture (int64_t texture_id, size_t w, size_t h, FlutterMetalExternalTexture *output)
 
TestMetalContextGetTestMetalContext ()
 
TestMetalSurfaceGetTestMetalSurface ()
 
void SetNextDrawableCallback (NextDrawableCallback next_drawable_callback)
 
FlutterMetalTexture GetNextDrawable (const FlutterFrameInfo *frame_info)
 
- 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)
 

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)>
 
- 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)
 
- 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 15 of file embedder_test_context_metal.h.

Member Typedef Documentation

◆ NextDrawableCallback

Definition at line 23 of file embedder_test_context_metal.h.

◆ PresentCallback

Definition at line 26 of file embedder_test_context_metal.h.

◆ TestExternalTextureCallback

Definition at line 17 of file embedder_test_context_metal.h.

Constructor & Destructor Documentation

◆ EmbedderTestContextMetal()

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

Definition at line 17 of file embedder_test_context_metal.cc.

18 : EmbedderTestContext(std::move(assets_path)) {
19 metal_context_ = std::make_unique<TestMetalContext>();
20}
EmbedderTestContext(std::string assets_path="")

◆ ~EmbedderTestContextMetal()

flutter::testing::EmbedderTestContextMetal::~EmbedderTestContextMetal ( )
override

Definition at line 22 of file embedder_test_context_metal.cc.

22{}

Member Function Documentation

◆ GetContextType()

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

◆ GetNextDrawable()

FlutterMetalTexture flutter::testing::EmbedderTestContextMetal::GetNextDrawable ( const FlutterFrameInfo frame_info)

Definition at line 91 of file embedder_test_context_metal.cc.

92 {
93 if (next_drawable_callback_ != nullptr) {
94 return next_drawable_callback_(frame_info);
95 }
96
97 auto texture_info = metal_surface_->GetTextureInfo();
100 texture.texture_id = texture_info.texture_id;
101 texture.texture =
102 reinterpret_cast<FlutterMetalTextureHandle>(texture_info.texture);
103 return texture;
104}
const void * FlutterMetalTextureHandle
Alias for id<MTLTexture>.
Definition embedder.h:600
FlTexture * texture
size_t struct_size
The size of this struct. Must be sizeof(FlutterMetalTexture).
Definition embedder.h:649

◆ GetSurfacePresentCount()

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

Implements flutter::testing::EmbedderTestContext.

Definition at line 30 of file embedder_test_context_metal.cc.

30 {
31 return present_count_;
32}

◆ GetTestMetalContext()

TestMetalContext * flutter::testing::EmbedderTestContextMetal::GetTestMetalContext ( )

Definition at line 46 of file embedder_test_context_metal.cc.

46 {
47 return metal_context_.get();
48}

◆ GetTestMetalSurface()

TestMetalSurface * flutter::testing::EmbedderTestContextMetal::GetTestMetalSurface ( )

Definition at line 50 of file embedder_test_context_metal.cc.

50 {
51 return metal_surface_.get();
52}

◆ PopulateExternalTexture()

bool flutter::testing::EmbedderTestContextMetal::PopulateExternalTexture ( int64_t  texture_id,
size_t  w,
size_t  h,
FlutterMetalExternalTexture output 
)

Definition at line 74 of file embedder_test_context_metal.cc.

78 {
79 if (external_texture_frame_callback_ != nullptr) {
80 return external_texture_frame_callback_(texture_id, w, h, output);
81 } else {
82 return false;
83 }
84}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder h
Definition switches.h:59
SkScalar w
int64_t texture_id

◆ Present()

bool flutter::testing::EmbedderTestContextMetal::Present ( int64_t  texture_id)

Definition at line 59 of file embedder_test_context_metal.cc.

59 {
61 [&]() { return metal_surface_->GetRasterSurfaceSnapshot(); });
62 present_count_++;
63 if (present_callback_ != nullptr) {
64 return present_callback_(texture_id);
65 }
66 return metal_context_->Present(texture_id);
67}
void FireRootSurfacePresentCallbackIfPresent(const std::function< sk_sp< SkImage >(void)> &image_callback)

◆ SetExternalTextureCallback()

void flutter::testing::EmbedderTestContextMetal::SetExternalTextureCallback ( TestExternalTextureCallback  external_texture_frame_callback)

Definition at line 69 of file embedder_test_context_metal.cc.

70 {
71 external_texture_frame_callback_ = std::move(external_texture_frame_callback);
72}

◆ SetNextDrawableCallback()

void flutter::testing::EmbedderTestContextMetal::SetNextDrawableCallback ( NextDrawableCallback  next_drawable_callback)

Definition at line 86 of file embedder_test_context_metal.cc.

87 {
88 next_drawable_callback_ = std::move(next_drawable_callback);
89}

◆ SetPresentCallback()

void flutter::testing::EmbedderTestContextMetal::SetPresentCallback ( PresentCallback  present_callback)

Definition at line 54 of file embedder_test_context_metal.cc.

55 {
56 present_callback_ = std::move(present_callback);
57}

◆ SetupCompositor()

void flutter::testing::EmbedderTestContextMetal::SetupCompositor ( )
overridevirtual

Implements flutter::testing::EmbedderTestContext.

Definition at line 38 of file embedder_test_context_metal.cc.

38 {
39 FML_CHECK(!compositor_) << "Already set up a compositor in this context.";
40 FML_CHECK(metal_surface_)
41 << "Set up the Metal surface before setting up a compositor.";
42 compositor_ = std::make_unique<EmbedderTestCompositorMetal>(
43 surface_size_, metal_surface_->GetGrContext());
44}
std::unique_ptr< EmbedderTestCompositor > compositor_
#define FML_CHECK(condition)
Definition logging.h:85

◆ SetupSurface()

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

Implements flutter::testing::EmbedderTestContext.

Definition at line 24 of file embedder_test_context_metal.cc.

24 {
25 FML_CHECK(surface_size_.isEmpty());
26 surface_size_ = surface_size;
27 metal_surface_ = TestMetalSurface::Create(*metal_context_, surface_size_);
28}
static std::unique_ptr< TestMetalSurface > Create(const TestMetalContext &test_metal_context, SkISize surface_size=SkISize::MakeEmpty())
bool isEmpty() const
Definition SkSize.h:31

Friends And Related Symbol Documentation

◆ EmbedderConfigBuilder

friend class EmbedderConfigBuilder
friend

Definition at line 65 of file embedder_test_context_metal.h.


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