Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | List of all members
flutter::EmbedderExternalViewEmbedder Class Referencefinal

The external view embedder used by the generic embedder API. This class acts a proxy between the rasterizer and the embedder when the rasterizer is rendering into multiple layers. It asks the embedder for the render targets for the various layers the rasterizer is rendering into, recycles the render targets as necessary and converts rasterizer specific metadata into an embedder friendly format so that it can present the layers on-screen. More...

#include <embedder_external_view_embedder.h>

Inheritance diagram for flutter::EmbedderExternalViewEmbedder:
flutter::ExternalViewEmbedder

Public Types

using CreateRenderTargetCallback = std::function< std::unique_ptr< EmbedderRenderTarget >(GrDirectContext *context, const std::shared_ptr< impeller::AiksContext > &aiks_context, const FlutterBackingStoreConfig &config)>
 
using PresentCallback = std::function< bool(FlutterViewId view_id, const std::vector< const FlutterLayer * > &layers)>
 
using SurfaceTransformationCallback = std::function< SkMatrix(void)>
 

Public Member Functions

 EmbedderExternalViewEmbedder (bool avoid_backing_store_cache, const CreateRenderTargetCallback &create_render_target_callback, const PresentCallback &present_callback)
 Creates an external view embedder used by the generic embedder API. More...
 
 ~EmbedderExternalViewEmbedder () override
 Collects the external view embedder. More...
 
void CollectView (int64_t view_id) override
 
void SetSurfaceTransformationCallback (SurfaceTransformationCallback surface_transformation_callback)
 Sets the surface transformation callback used by the external view embedder to ask the platform for the per frame root surface transformation. More...
 
- Public Member Functions inherited from flutter::ExternalViewEmbedder
 ExternalViewEmbedder ()=default
 
virtual ~ExternalViewEmbedder ()=default
 
virtual void CollectView (int64_t view_id)
 
virtual DlCanvasGetRootCanvas ()=0
 
virtual void CancelFrame ()=0
 
virtual void BeginFrame (GrDirectContext *context, const fml::RefPtr< fml::RasterThreadMerger > &raster_thread_merger)=0
 
virtual void PrerollCompositeEmbeddedView (int64_t platform_view_id, std::unique_ptr< EmbeddedViewParams > params)=0
 
virtual PostPrerollResult PostPrerollAction (const fml::RefPtr< fml::RasterThreadMerger > &raster_thread_merger)
 
virtual DlCanvasCompositeEmbeddedView (int64_t platform_view_id)=0
 
virtual void PrepareFlutterView (SkISize frame_size, double device_pixel_ratio)=0
 
virtual void SubmitFlutterView (int64_t flutter_view_id, GrDirectContext *context, const std::shared_ptr< impeller::AiksContext > &aiks_context, std::unique_ptr< SurfaceFrame > frame)
 
virtual void EndFrame (bool should_resubmit_frame, const fml::RefPtr< fml::RasterThreadMerger > &raster_thread_merger)
 
virtual bool SupportsDynamicThreadMerging ()
 
virtual void Teardown ()
 
void SetUsedThisFrame (bool used_this_frame)
 
bool GetUsedThisFrame () const
 
virtual void PushVisitedPlatformView (int64_t platform_view_id)
 
virtual void PushFilterToVisitedPlatformViews (const std::shared_ptr< const DlImageFilter > &filter, const SkRect &filter_rect)
 

Detailed Description

The external view embedder used by the generic embedder API. This class acts a proxy between the rasterizer and the embedder when the rasterizer is rendering into multiple layers. It asks the embedder for the render targets for the various layers the rasterizer is rendering into, recycles the render targets as necessary and converts rasterizer specific metadata into an embedder friendly format so that it can present the layers on-screen.

Definition at line 30 of file embedder_external_view_embedder.h.

Member Typedef Documentation

◆ CreateRenderTargetCallback

Definition at line 32 of file embedder_external_view_embedder.h.

◆ PresentCallback

using flutter::EmbedderExternalViewEmbedder::PresentCallback = std::function<bool(FlutterViewId view_id, const std::vector<const FlutterLayer*>& layers)>

Definition at line 37 of file embedder_external_view_embedder.h.

◆ SurfaceTransformationCallback

Definition at line 40 of file embedder_external_view_embedder.h.

Constructor & Destructor Documentation

◆ EmbedderExternalViewEmbedder()

flutter::EmbedderExternalViewEmbedder::EmbedderExternalViewEmbedder ( bool  avoid_backing_store_cache,
const CreateRenderTargetCallback create_render_target_callback,
const PresentCallback present_callback 
)

Creates an external view embedder used by the generic embedder API.

Parameters
[in]avoid_backing_store_cacheIf set, create_render_target_callback will beinvoked every frame for every engine composited layer. The result will not cached.
[in]create_render_target_callbackThe render target callback used to request the render target for a layer.
[in]present_callbackThe callback used to forward a collection of layers (backed by fulfilled render targets) to the embedder for presentation.

Definition at line 19 of file embedder_external_view_embedder.cc.

23 : avoid_backing_store_cache_(avoid_backing_store_cache),
24 create_render_target_callback_(create_render_target_callback),
25 present_callback_(present_callback) {
26 FML_DCHECK(create_render_target_callback_);
27 FML_DCHECK(present_callback_);
28}
#define FML_DCHECK(condition)
Definition: logging.h:103

◆ ~EmbedderExternalViewEmbedder()

flutter::EmbedderExternalViewEmbedder::~EmbedderExternalViewEmbedder ( )
overridedefault

Collects the external view embedder.

Member Function Documentation

◆ CollectView()

void flutter::EmbedderExternalViewEmbedder::CollectView ( int64_t  view_id)
overridevirtual

Reimplemented from flutter::ExternalViewEmbedder.

Definition at line 32 of file embedder_external_view_embedder.cc.

32 {
33 render_target_caches_.erase(view_id);
34}

◆ SetSurfaceTransformationCallback()

void flutter::EmbedderExternalViewEmbedder::SetSurfaceTransformationCallback ( SurfaceTransformationCallback  surface_transformation_callback)

Sets the surface transformation callback used by the external view embedder to ask the platform for the per frame root surface transformation.

Parameters
[in]surface_transformation_callbackThe surface transformation callback

Definition at line 36 of file embedder_external_view_embedder.cc.

37 {
38 surface_transformation_callback_ = std::move(surface_transformation_callback);
39}

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