Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
flutter::testing::EmbedderTestCompositor Class Referenceabstract

#include <embedder_test_compositor.h>

Inheritance diagram for flutter::testing::EmbedderTestCompositor:
flutter::testing::EmbedderTestCompositorGL flutter::testing::EmbedderTestCompositorMetal flutter::testing::EmbedderTestCompositorSoftware flutter::testing::EmbedderTestCompositorVulkan

Public Types

using PlatformViewRendererCallback = std::function< sk_sp< SkImage >(const FlutterLayer &layer, GrDirectContext *context)>
 
using PresentCallback = std::function< void(FlutterViewId view_id, const FlutterLayer **layers, size_t layers_count)>
 
using NextSceneCallback = std::function< void(sk_sp< SkImage > image)>
 

Public Member Functions

 EmbedderTestCompositor (SkISize surface_size, sk_sp< GrDirectContext > context)
 
virtual ~EmbedderTestCompositor ()
 
void SetBackingStoreProducer (std::unique_ptr< EmbedderTestBackingStoreProducer > backingstore_producer)
 
bool CreateBackingStore (const FlutterBackingStoreConfig *config, FlutterBackingStore *backing_store_out)
 
bool CollectBackingStore (const FlutterBackingStore *backing_store)
 
bool Present (FlutterViewId view_id, const FlutterLayer **layers, size_t layers_count)
 
void SetPlatformViewRendererCallback (const PlatformViewRendererCallback &callback)
 
void SetNextPresentCallback (const PresentCallback &next_present_callback)
 Allows tests to install a callback to notify them when the entire render tree has been finalized so they can run their assertions. More...
 
void SetPresentCallback (const PresentCallback &present_callback, bool one_shot)
 
void SetNextSceneCallback (const NextSceneCallback &next_scene_callback)
 
sk_sp< SkImageGetLastComposition ()
 
size_t GetPendingBackingStoresCount () const
 
size_t GetBackingStoresCreatedCount () const
 
size_t GetBackingStoresCollectedCount () const
 
void AddOnCreateRenderTargetCallback (const fml::closure &callback)
 
void AddOnCollectRenderTargetCallback (const fml::closure &callback)
 
void AddOnPresentCallback (const fml::closure &callback)
 
sk_sp< GrDirectContextGetGrContext ()
 

Protected Member Functions

virtual bool UpdateOffscrenComposition (const FlutterLayer **layers, size_t layers_count)=0
 
 FML_DISALLOW_COPY_AND_ASSIGN (EmbedderTestCompositor)
 

Protected Attributes

std::unique_ptr< EmbedderTestBackingStoreProducerbackingstore_producer_
 
const SkISize surface_size_
 
sk_sp< GrDirectContextcontext_
 
PlatformViewRendererCallback platform_view_renderer_callback_
 
bool present_callback_is_one_shot_ = false
 
PresentCallback present_callback_
 
NextSceneCallback next_scene_callback_
 
sk_sp< SkImagelast_composition_
 
size_t backing_stores_created_ = 0
 
size_t backing_stores_collected_ = 0
 
std::vector< fml::closureon_create_render_target_callbacks_
 
std::vector< fml::closureon_collect_render_target_callbacks_
 
std::vector< fml::closureon_present_callbacks_
 

Detailed Description

Definition at line 19 of file embedder_test_compositor.h.

Member Typedef Documentation

◆ NextSceneCallback

Definition at line 59 of file embedder_test_compositor.h.

◆ PlatformViewRendererCallback

Definition at line 21 of file embedder_test_compositor.h.

◆ PresentCallback

using flutter::testing::EmbedderTestCompositor::PresentCallback = std::function<void(FlutterViewId view_id, const FlutterLayer** layers, size_t layers_count)>

Definition at line 24 of file embedder_test_compositor.h.

Constructor & Destructor Documentation

◆ EmbedderTestCompositor()

flutter::testing::EmbedderTestCompositor::EmbedderTestCompositor ( SkISize  surface_size,
sk_sp< GrDirectContext context 
)

Definition at line 16 of file embedder_test_compositor.cc.

18 : surface_size_(surface_size), context_(std::move(context)) {
19 FML_CHECK(!surface_size_.isEmpty()) << "Surface size must not be empty";
20}
#define FML_CHECK(condition)
Definition: logging.h:85
bool isEmpty() const
Definition: SkSize.h:31

◆ ~EmbedderTestCompositor()

flutter::testing::EmbedderTestCompositor::~EmbedderTestCompositor ( )
virtualdefault

Member Function Documentation

◆ AddOnCollectRenderTargetCallback()

void flutter::testing::EmbedderTestCompositor::AddOnCollectRenderTargetCallback ( const fml::closure callback)

Definition at line 128 of file embedder_test_compositor.cc.

129 {
131}
std::vector< fml::closure > on_collect_render_target_callbacks_
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

◆ AddOnCreateRenderTargetCallback()

void flutter::testing::EmbedderTestCompositor::AddOnCreateRenderTargetCallback ( const fml::closure callback)

Definition at line 123 of file embedder_test_compositor.cc.

124 {
126}
std::vector< fml::closure > on_create_render_target_callbacks_

◆ AddOnPresentCallback()

void flutter::testing::EmbedderTestCompositor::AddOnPresentCallback ( const fml::closure callback)

Definition at line 133 of file embedder_test_compositor.cc.

134 {
136}

◆ CollectBackingStore()

bool flutter::testing::EmbedderTestCompositor::CollectBackingStore ( const FlutterBackingStore backing_store)

Definition at line 43 of file embedder_test_compositor.cc.

44 {
45 // We have already set the destruction callback for the various backing
46 // stores. Our user_data is just the canvas from that backing store and does
47 // not need to be explicitly collected. Embedders might have some other state
48 // they want to collect though.
51 return true;
52}
static void InvokeAllCallbacks(const std::vector< fml::closure > &callbacks)

◆ CreateBackingStore()

bool flutter::testing::EmbedderTestCompositor::CreateBackingStore ( const FlutterBackingStoreConfig config,
FlutterBackingStore backing_store_out 
)

Definition at line 32 of file embedder_test_compositor.cc.

34 {
35 bool success = backingstore_producer_->Create(config, backing_store_out);
36 if (success) {
39 }
40 return success;
41}
std::unique_ptr< EmbedderTestBackingStoreProducer > backingstore_producer_

◆ FML_DISALLOW_COPY_AND_ASSIGN()

flutter::testing::EmbedderTestCompositor::FML_DISALLOW_COPY_AND_ASSIGN ( EmbedderTestCompositor  )
protected

◆ GetBackingStoresCollectedCount()

size_t flutter::testing::EmbedderTestCompositor::GetBackingStoresCollectedCount ( ) const

Definition at line 119 of file embedder_test_compositor.cc.

119 {
121}

◆ GetBackingStoresCreatedCount()

size_t flutter::testing::EmbedderTestCompositor::GetBackingStoresCreatedCount ( ) const

Definition at line 115 of file embedder_test_compositor.cc.

115 {
117}

◆ GetGrContext()

sk_sp< GrDirectContext > flutter::testing::EmbedderTestCompositor::GetGrContext ( )

Definition at line 138 of file embedder_test_compositor.cc.

138 {
139 return context_;
140}

◆ GetLastComposition()

sk_sp< SkImage > flutter::testing::EmbedderTestCompositor::GetLastComposition ( )

Definition at line 59 of file embedder_test_compositor.cc.

◆ GetPendingBackingStoresCount()

size_t flutter::testing::EmbedderTestCompositor::GetPendingBackingStoresCount ( ) const

◆ Present()

bool flutter::testing::EmbedderTestCompositor::Present ( FlutterViewId  view_id,
const FlutterLayer **  layers,
size_t  layers_count 
)

Definition at line 63 of file embedder_test_compositor.cc.

65 {
66 if (!UpdateOffscrenComposition(layers, layers_count)) {
68 << "Could not update the off-screen composition in the test compositor";
69 return false;
70 }
71
72 // If the test has asked to access the layers and renderers being presented.
73 // Access the same and present it to the test for its test assertions.
77 present_callback_ = nullptr;
78 }
79 callback(view_id, layers, layers_count);
80 }
81
83 return true;
84}
virtual bool UpdateOffscrenComposition(const FlutterLayer **layers, size_t layers_count)=0
#define FML_LOG(severity)
Definition: logging.h:82
#define ERROR(message)
Definition: elf_loader.cc:260

◆ SetBackingStoreProducer()

void flutter::testing::EmbedderTestCompositor::SetBackingStoreProducer ( std::unique_ptr< EmbedderTestBackingStoreProducer backingstore_producer)

Definition at line 54 of file embedder_test_compositor.cc.

55 {
56 backingstore_producer_ = std::move(backingstore_producer);
57}

◆ SetNextPresentCallback()

void flutter::testing::EmbedderTestCompositor::SetNextPresentCallback ( const PresentCallback next_present_callback)

Allows tests to install a callback to notify them when the entire render tree has been finalized so they can run their assertions.

Parameters
[in]next_present_callbackThe next present callback

Definition at line 86 of file embedder_test_compositor.cc.

87 {
88 SetPresentCallback(next_present_callback, true);
89}
void SetPresentCallback(const PresentCallback &present_callback, bool one_shot)

◆ SetNextSceneCallback()

void flutter::testing::EmbedderTestCompositor::SetNextSceneCallback ( const NextSceneCallback next_scene_callback)

Definition at line 99 of file embedder_test_compositor.cc.

100 {
102 next_scene_callback_ = next_scene_callback;
103}

◆ SetPlatformViewRendererCallback()

void flutter::testing::EmbedderTestCompositor::SetPlatformViewRendererCallback ( const PlatformViewRendererCallback callback)

Definition at line 105 of file embedder_test_compositor.cc.

◆ SetPresentCallback()

void flutter::testing::EmbedderTestCompositor::SetPresentCallback ( const PresentCallback present_callback,
bool  one_shot 
)

Definition at line 91 of file embedder_test_compositor.cc.

93 {
95 present_callback_ = present_callback;
97}

◆ UpdateOffscrenComposition()

virtual bool flutter::testing::EmbedderTestCompositor::UpdateOffscrenComposition ( const FlutterLayer **  layers,
size_t  layers_count 
)
protectedpure virtual

Member Data Documentation

◆ backing_stores_collected_

size_t flutter::testing::EmbedderTestCompositor::backing_stores_collected_ = 0
protected

Definition at line 93 of file embedder_test_compositor.h.

◆ backing_stores_created_

size_t flutter::testing::EmbedderTestCompositor::backing_stores_created_ = 0
protected

Definition at line 92 of file embedder_test_compositor.h.

◆ backingstore_producer_

std::unique_ptr<EmbedderTestBackingStoreProducer> flutter::testing::EmbedderTestCompositor::backingstore_producer_
protected

Definition at line 83 of file embedder_test_compositor.h.

◆ context_

sk_sp<GrDirectContext> flutter::testing::EmbedderTestCompositor::context_
protected

Definition at line 85 of file embedder_test_compositor.h.

◆ last_composition_

sk_sp<SkImage> flutter::testing::EmbedderTestCompositor::last_composition_
protected

Definition at line 91 of file embedder_test_compositor.h.

◆ next_scene_callback_

NextSceneCallback flutter::testing::EmbedderTestCompositor::next_scene_callback_
protected

Definition at line 90 of file embedder_test_compositor.h.

◆ on_collect_render_target_callbacks_

std::vector<fml::closure> flutter::testing::EmbedderTestCompositor::on_collect_render_target_callbacks_
protected

Definition at line 95 of file embedder_test_compositor.h.

◆ on_create_render_target_callbacks_

std::vector<fml::closure> flutter::testing::EmbedderTestCompositor::on_create_render_target_callbacks_
protected

Definition at line 94 of file embedder_test_compositor.h.

◆ on_present_callbacks_

std::vector<fml::closure> flutter::testing::EmbedderTestCompositor::on_present_callbacks_
protected

Definition at line 96 of file embedder_test_compositor.h.

◆ platform_view_renderer_callback_

PlatformViewRendererCallback flutter::testing::EmbedderTestCompositor::platform_view_renderer_callback_
protected

Definition at line 87 of file embedder_test_compositor.h.

◆ present_callback_

PresentCallback flutter::testing::EmbedderTestCompositor::present_callback_
protected

Definition at line 89 of file embedder_test_compositor.h.

◆ present_callback_is_one_shot_

bool flutter::testing::EmbedderTestCompositor::present_callback_is_one_shot_ = false
protected

Definition at line 88 of file embedder_test_compositor.h.

◆ surface_size_

const SkISize flutter::testing::EmbedderTestCompositor::surface_size_
protected

Definition at line 84 of file embedder_test_compositor.h.


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