Flutter Engine
flutter::PlatformView::Delegate Class Referenceabstract

Used to forward events from the platform view to interested subsystems. This forwarding is done by the shell which sets itself up as the delegate of the platform view. More...

#include <platform_view.h>

Inheritance diagram for flutter::PlatformView::Delegate:
flutter::Shell

Public Member Functions

virtual void OnPlatformViewCreated (std::unique_ptr< Surface > surface)=0
 Notifies the delegate that the platform view was created with the given render surface. This surface is platform (iOS, Android) and client-rendering API (OpenGL, Software, Metal, Vulkan) specific. This is usually a sign to the rasterizer to setup and begin rendering to that surface. More...
 
virtual void OnPlatformViewDestroyed ()=0
 Notifies the delegate that the platform view was destroyed. This is usually a sign to the rasterizer to suspend rendering a previously configured surface and collect any intermediate resources. More...
 
virtual void OnPlatformViewSetNextFrameCallback (const fml::closure &closure)=0
 Notifies the delegate that the specified callback needs to be invoked after the rasterizer is done rendering the next frame. This callback will be called on the render thread and it is caller responsibility to perform any re-threading as necessary. Due to the asynchronous nature of rendering in Flutter, embedders usually add a placeholder over the contents in which Flutter is going to render when Flutter is first initialized. This callback may be used as a signal to remove that placeholder. More...
 
virtual void OnPlatformViewSetViewportMetrics (const ViewportMetrics &metrics)=0
 Notifies the delegate the viewport metrics of the platform view have been updated. The rasterizer will need to be reconfigured to render the frame in the updated viewport metrics. More...
 
virtual void OnPlatformViewDispatchPlatformMessage (fml::RefPtr< PlatformMessage > message)=0
 Notifies the delegate that the platform has dispatched a platform message from the embedder to the Flutter application. This message must be forwarded to the running isolate hosted by the engine on the UI thread. More...
 
virtual void OnPlatformViewDispatchPointerDataPacket (std::unique_ptr< PointerDataPacket > packet)=0
 Notifies the delegate that the platform view has encountered a pointer event. This pointer event needs to be forwarded to the running root isolate hosted by the engine on the UI thread. More...
 
virtual void OnPlatformViewDispatchSemanticsAction (int32_t id, SemanticsAction action, std::vector< uint8_t > args)=0
 Notifies the delegate that the platform view has encountered an accessibility related action on the specified node. This event must be forwarded to the running root isolate hosted by the engine on the UI thread. More...
 
virtual void OnPlatformViewSetSemanticsEnabled (bool enabled)=0
 Notifies the delegate that the embedder has expressed an opinion about whether the accessibility tree needs to be enabled or disabled. This information needs to be forwarded to the root isolate running on the UI thread. More...
 
virtual void OnPlatformViewSetAccessibilityFeatures (int32_t flags)=0
 Notifies the delegate that the embedder has expressed an opinion about the features to enable in the accessibility tree. More...
 
virtual void OnPlatformViewRegisterTexture (std::shared_ptr< Texture > texture)=0
 Notifies the delegate that the embedder has specified a texture that it want the rasterizer to composite within the Flutter layer tree. All textures must have a unique identifier. When the rasterizer encounters an external texture within its hierarchy, it gives the embedder a chance to update that texture on the raster thread before it composites the same on-screen. More...
 
virtual void OnPlatformViewUnregisterTexture (int64_t texture_id)=0
 Notifies the delegate that the embedder will no longer attempt to composite the specified texture within the layer tree. This allows the rasterizer to collect associated resources. More...
 
virtual void OnPlatformViewMarkTextureFrameAvailable (int64_t texture_id)=0
 Notifies the delegate that the embedder has updated the contents of the texture with the specified identifier. Typically, Flutter will only render a frame if there is an updated layer tree. However, in cases where the layer tree is static but one of the externally composited textures has been updated by the embedder, the embedder needs to notify the rasterizer to render a new frame. In such cases, the existing layer tree may be reused with the frame composited with all updated external textures. More...
 
virtual std::unique_ptr< std::vector< std::string > > ComputePlatformViewResolvedLocale (const std::vector< std::string > &supported_locale_data)=0
 Directly invokes platform-specific APIs to compute the locale the platform would have natively resolved to. More...
 

Detailed Description

Used to forward events from the platform view to interested subsystems. This forwarding is done by the shell which sets itself up as the delegate of the platform view.

Definition at line 51 of file platform_view.h.

Member Function Documentation

◆ ComputePlatformViewResolvedLocale()

virtual std::unique_ptr<std::vector<std::string> > flutter::PlatformView::Delegate::ComputePlatformViewResolvedLocale ( const std::vector< std::string > &  supported_locale_data)
pure virtual

Directly invokes platform-specific APIs to compute the locale the platform would have natively resolved to.

Parameters
[in]supported_locale_dataThe vector of strings that represents the locales supported by the app. Each locale consists of three strings: languageCode, countryCode, and scriptCode in that order.
Returns
A vector of 3 strings languageCode, countryCode, and scriptCode that represents the locale selected by the platform. Empty strings mean the value was unassigned. Empty vector represents a null locale.

◆ OnPlatformViewCreated()

virtual void flutter::PlatformView::Delegate::OnPlatformViewCreated ( std::unique_ptr< Surface surface)
pure virtual

Notifies the delegate that the platform view was created with the given render surface. This surface is platform (iOS, Android) and client-rendering API (OpenGL, Software, Metal, Vulkan) specific. This is usually a sign to the rasterizer to setup and begin rendering to that surface.

Parameters
[in]surfaceThe surface

Referenced by flutter::PlatformView::NotifyCreated().

◆ OnPlatformViewDestroyed()

virtual void flutter::PlatformView::Delegate::OnPlatformViewDestroyed ( )
pure virtual

Notifies the delegate that the platform view was destroyed. This is usually a sign to the rasterizer to suspend rendering a previously configured surface and collect any intermediate resources.

Referenced by flutter::PlatformView::NotifyDestroyed().

◆ OnPlatformViewDispatchPlatformMessage()

virtual void flutter::PlatformView::Delegate::OnPlatformViewDispatchPlatformMessage ( fml::RefPtr< PlatformMessage message)
pure virtual

Notifies the delegate that the platform has dispatched a platform message from the embedder to the Flutter application. This message must be forwarded to the running isolate hosted by the engine on the UI thread.

Parameters
[in]messageThe platform message to dispatch to the running root isolate.

Referenced by flutter::PlatformView::DispatchPlatformMessage().

◆ OnPlatformViewDispatchPointerDataPacket()

virtual void flutter::PlatformView::Delegate::OnPlatformViewDispatchPointerDataPacket ( std::unique_ptr< PointerDataPacket packet)
pure virtual

Notifies the delegate that the platform view has encountered a pointer event. This pointer event needs to be forwarded to the running root isolate hosted by the engine on the UI thread.

Parameters
[in]packetThe pointer data packet containing multiple pointer events.

Referenced by flutter::PlatformView::DispatchPointerDataPacket().

◆ OnPlatformViewDispatchSemanticsAction()

virtual void flutter::PlatformView::Delegate::OnPlatformViewDispatchSemanticsAction ( int32_t  id,
SemanticsAction  action,
std::vector< uint8_t >  args 
)
pure virtual

Notifies the delegate that the platform view has encountered an accessibility related action on the specified node. This event must be forwarded to the running root isolate hosted by the engine on the UI thread.

Parameters
[in]idThe identifier of the accessibility node.
[in]actionThe accessibility related action performed on the node of the specified ID.
[in]argsAn optional list of argument that apply to the specified action.

Referenced by flutter::PlatformView::DispatchSemanticsAction().

◆ OnPlatformViewMarkTextureFrameAvailable()

virtual void flutter::PlatformView::Delegate::OnPlatformViewMarkTextureFrameAvailable ( int64_t  texture_id)
pure virtual

Notifies the delegate that the embedder has updated the contents of the texture with the specified identifier. Typically, Flutter will only render a frame if there is an updated layer tree. However, in cases where the layer tree is static but one of the externally composited textures has been updated by the embedder, the embedder needs to notify the rasterizer to render a new frame. In such cases, the existing layer tree may be reused with the frame composited with all updated external textures.

Parameters
[in]texture_idThe identifier of the texture that has been updated.

Referenced by flutter::PlatformView::MarkTextureFrameAvailable().

◆ OnPlatformViewRegisterTexture()

virtual void flutter::PlatformView::Delegate::OnPlatformViewRegisterTexture ( std::shared_ptr< Texture texture)
pure virtual

Notifies the delegate that the embedder has specified a texture that it want the rasterizer to composite within the Flutter layer tree. All textures must have a unique identifier. When the rasterizer encounters an external texture within its hierarchy, it gives the embedder a chance to update that texture on the raster thread before it composites the same on-screen.

Parameters
[in]textureThe texture that is being updated by the embedder but composited by Flutter in its own hierarchy.

Referenced by flutter::PlatformView::RegisterTexture().

◆ OnPlatformViewSetAccessibilityFeatures()

virtual void flutter::PlatformView::Delegate::OnPlatformViewSetAccessibilityFeatures ( int32_t  flags)
pure virtual

Notifies the delegate that the embedder has expressed an opinion about the features to enable in the accessibility tree.

The engine does not care about the accessibility feature flags as all it does is forward this information from the embedder to the framework. However, curious readers may refer to AccessibilityFeatures in window.dart for currently supported accessibility feature flags.

Parameters
[in]flagsThe features to enable in the accessibility tree.

Referenced by flutter::PlatformView::SetAccessibilityFeatures().

◆ OnPlatformViewSetNextFrameCallback()

virtual void flutter::PlatformView::Delegate::OnPlatformViewSetNextFrameCallback ( const fml::closure closure)
pure virtual

Notifies the delegate that the specified callback needs to be invoked after the rasterizer is done rendering the next frame. This callback will be called on the render thread and it is caller responsibility to perform any re-threading as necessary. Due to the asynchronous nature of rendering in Flutter, embedders usually add a placeholder over the contents in which Flutter is going to render when Flutter is first initialized. This callback may be used as a signal to remove that placeholder.

Attention
The callback will be invoked on the render thread and not the calling thread.
Parameters
[in]closureThe callback to execute on the next frame.

Referenced by flutter::PlatformView::SetNextFrameCallback().

◆ OnPlatformViewSetSemanticsEnabled()

virtual void flutter::PlatformView::Delegate::OnPlatformViewSetSemanticsEnabled ( bool  enabled)
pure virtual

Notifies the delegate that the embedder has expressed an opinion about whether the accessibility tree needs to be enabled or disabled. This information needs to be forwarded to the root isolate running on the UI thread.

Parameters
[in]enabledWhether the accessibility tree is enabled or disabled.

Referenced by flutter::PlatformView::SetSemanticsEnabled().

◆ OnPlatformViewSetViewportMetrics()

virtual void flutter::PlatformView::Delegate::OnPlatformViewSetViewportMetrics ( const ViewportMetrics metrics)
pure virtual

Notifies the delegate the viewport metrics of the platform view have been updated. The rasterizer will need to be reconfigured to render the frame in the updated viewport metrics.

Parameters
[in]metricsThe updated viewport metrics.

Referenced by flutter::PlatformView::SetViewportMetrics().

◆ OnPlatformViewUnregisterTexture()

virtual void flutter::PlatformView::Delegate::OnPlatformViewUnregisterTexture ( int64_t  texture_id)
pure virtual

Notifies the delegate that the embedder will no longer attempt to composite the specified texture within the layer tree. This allows the rasterizer to collect associated resources.

Parameters
[in]texture_idThe identifier of the texture to unregister. If the texture has not been previously registered, this call does nothing.

Referenced by flutter::PlatformView::UnregisterTexture().


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