Flutter Engine
 
Loading...
Searching...
No Matches
flutter::PlatformViewIOS Class Referencefinal

#include <platform_view_ios.h>

Inheritance diagram for flutter::PlatformViewIOS:
flutter::PlatformView

Public Member Functions

 PlatformViewIOS (PlatformView::Delegate &delegate, const std::shared_ptr< IOSContext > &context, __weak FlutterPlatformViewsController *platform_views_controller, const flutter::TaskRunners &task_runners)
 
 PlatformViewIOS (PlatformView::Delegate &delegate, IOSRenderingAPI rendering_api, __weak FlutterPlatformViewsController *platform_views_controller, const flutter::TaskRunners &task_runners, const std::shared_ptr< fml::ConcurrentTaskRunner > &worker_task_runner, const std::shared_ptr< const fml::SyncSwitch > &is_gpu_disabled_sync_switch)
 
 ~PlatformViewIOS () override
 
FlutterViewControllerGetOwnerViewController () const __attribute__((cf_audited_transfer))
 
void SetOwnerViewController (__weak FlutterViewController *owner_controller)
 
void attachView ()
 
void RegisterExternalTexture (int64_t id, NSObject< FlutterTexture > *texture)
 
PointerDataDispatcherMaker GetDispatcherMaker () override
 Returns a platform-specific PointerDataDispatcherMaker so the Engine can construct the PointerDataPacketDispatcher based on platforms.
 
void SetSemanticsEnabled (bool enabled) override
 Used by embedder to notify the running isolate hosted by the engine on the UI thread that the accessibility tree needs to be generated.
 
void SetSemanticsTreeEnabled (bool enabled) override
 Used by the framework to tell the embedder to prepare or clear resoruce for accepting semantics tree.
 
void HandlePlatformMessage (std::unique_ptr< flutter::PlatformMessage > message) override
 
std::unique_ptr< SurfaceCreateRenderingSurface () override
 
std::shared_ptr< ExternalViewEmbedderCreateExternalViewEmbedder () override
 
std::shared_ptr< impeller::ContextGetImpellerContext () const override
 
void SetAccessibilityFeatures (int32_t flags) override
 Used by the embedder to specify the features to enable in the accessibility tree generated by the isolate. This information is forwarded to the root isolate hosted by the engine on the UI thread.
 
void UpdateSemantics (int64_t view_id, flutter::SemanticsNodeUpdates update, flutter::CustomAccessibilityActionUpdates actions) override
 Used by the framework to tell the embedder to apply the specified semantics node updates. The default implementation of this method does nothing.
 
void SetApplicationLocale (std::string locale) override
 Used by the framework to set application locale in the embedding.
 
std::unique_ptr< VsyncWaiterCreateVSyncWaiter () override
 Invoked by the shell to obtain a platform specific vsync waiter. It is optional for platforms to override this method and provide a custom vsync waiter because a timer based fall-back waiter is used by default. However, it is highly recommended that platform provide their own Vsync waiter as the timer based fall-back will not render frames aligned with vsync boundaries.
 
void OnPreEngineRestart () const override
 Gives embedders a chance to react to a "cold restart" of the running isolate. The default implementation of this method does nothing.
 
std::unique_ptr< std::vector< std::string > > ComputePlatformResolvedLocales (const std::vector< std::string > &supported_locale_data) override
 Directly invokes platform-specific APIs to compute the locale the platform would have natively resolved to.
 
const std::shared_ptr< IOSContext > & GetIosContext ()
 
std::shared_ptr< PlatformMessageHandlerIosGetPlatformMessageHandlerIos () const
 
std::shared_ptr< PlatformMessageHandlerGetPlatformMessageHandler () const override
 Specifies a delegate that will receive PlatformMessages from Flutter to the host platform.
 
AccessibilityBridgeGetAccessibilityBridge ()
 
- Public Member Functions inherited from flutter::PlatformView
 PlatformView (Delegate &delegate, const TaskRunners &task_runners)
 Creates a platform view with the specified delegate and task runner. The base class by itself does not do much but is suitable for use in test environments where full platform integration may not be necessary. The platform view may only be created, accessed and destroyed on the platform task runner.
 
virtual ~PlatformView ()
 Destroys the platform view. The platform view is owned by the shell and will be destroyed by the same on the platform tasks runner.
 
void DispatchPlatformMessage (std::unique_ptr< PlatformMessage > message)
 Used by embedders to dispatch a platform message to a running root isolate hosted by the engine. If an isolate is not running, the message is dropped. If there is no one on the other side listening on the channel, the message is dropped. When a platform message is dropped, any response handles associated with that message will be dropped as well. All users of platform messages must assume that message may not be delivered and/or their response handles may not be invoked. Platform messages are not buffered.
 
virtual void HandlePlatformMessage (std::unique_ptr< PlatformMessage > message)
 Overridden by embedders to perform actions in response to platform messages sent from the framework to the embedder. Default implementation of this method simply returns an empty response.
 
void DispatchSemanticsAction (int64_t view_id, int32_t node_id, SemanticsAction action, fml::MallocMapping args)
 Used by embedders to dispatch an accessibility action to a running isolate hosted by the engine.
 
virtual void SendChannelUpdate (const std::string &name, bool listening)
 Used by the framework to tell the embedder that it has registered a listener on a given channel.
 
void SetViewportMetrics (int64_t view_id, const ViewportMetrics &metrics)
 Used by embedders to specify the updated viewport metrics for a view. In response to this call, on the raster thread, the rasterizer may need to be reconfigured to the updated viewport dimensions. On the UI thread, the framework may need to start generating a new frame for the updated viewport metrics as well.
 
void NotifyCreated ()
 Used by embedders to notify the shell that a platform view has been created. This notification is used to create a rendering surface and pick the client rendering API to use to render into this surface. No frames will be scheduled or rendered before this call. The surface must remain valid till the corresponding call to NotifyDestroyed.
 
virtual void NotifyDestroyed ()
 Used by embedders to notify the shell that the platform view has been destroyed. This notification used to collect the rendering surface and all associated resources. Frame scheduling is also suspended.
 
void ScheduleFrame ()
 Used by embedders to schedule a frame. In response to this call, the framework may need to start generating a new frame.
 
void AddView (int64_t view_id, const ViewportMetrics &viewport_metrics, AddViewCallback callback)
 Used by embedders to notify the shell of a new non-implicit view.
 
void RemoveView (int64_t view_id, RemoveViewCallback callback)
 Used by embedders to notify the shell of a removed non-implicit view.
 
void SendViewFocusEvent (const ViewFocusEvent &event)
 
virtual sk_sp< GrDirectContext > CreateResourceContext () const
 Used by the shell to obtain a Skia GPU context that is capable of operating on the IO thread. The context must be in the same share-group as the Skia GPU context used on the render thread. This context will always be used on the IO thread. Because it is in the same share-group as the separate render thread context, any GPU resources uploaded in this context will be visible to the render thread context (synchronization of GPU resources is managed by Skia).
 
virtual void ReleaseResourceContext () const
 Used by the shell to notify the embedder that the resource context previously obtained via a call to CreateResourceContext() is being collected. The embedder is free to collect an platform specific resources associated with this context.
 
fml::WeakPtr< PlatformViewGetWeakPtr () const
 Returns a weak pointer to the platform view. Since the platform view may only be created, accessed and destroyed on the platform thread, any access to the platform view from a non-platform task runner needs a weak pointer to the platform view along with a reference to the platform task runner. A task must be posted to the platform task runner with the weak pointer captured in the same. The platform view method may only be called in the posted task once the weak pointer validity has been checked. This method is used by callers to obtain that weak pointer.
 
void SetNextFrameCallback (const fml::closure &closure)
 Sets a callback that gets executed when the rasterizer renders the next frame. 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. The callback is executed on the render task runner and not the platform task runner. It is the embedder's responsibility to re-thread as necessary.
 
void DispatchPointerDataPacket (std::unique_ptr< PointerDataPacket > packet)
 Dispatches pointer events from the embedder to the framework. Each pointer data packet may contain multiple pointer input events. Each call to this method wakes up the UI thread.
 
void RegisterTexture (std::shared_ptr< flutter::Texture > texture)
 Used by the embedder to specify a texture that it wants 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.
 
void UnregisterTexture (int64_t texture_id)
 Used by the embedder to notify the rasterizer that it will no longer attempt to composite the specified texture within the layer tree. This allows the rasterizer to collect associated resources.
 
void MarkTextureFrameAvailable (int64_t texture_id)
 Used by the embedder to notify the rasterizer that the context of the previously registered texture have been updated. 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 re-composited with all updated external textures. Unlike the calls to register and unregister the texture, this call must be made each time a new texture frame is available.
 
virtual void RequestDartDeferredLibrary (intptr_t loading_unit_id)
 Invoked when the dart VM requests that a deferred library be loaded. Notifies the engine that the deferred library identified by the specified loading unit id should be downloaded and loaded into the Dart VM via LoadDartDeferredLibrary
 
virtual void LoadDartDeferredLibrary (intptr_t loading_unit_id, std::unique_ptr< const fml::Mapping > snapshot_data, std::unique_ptr< const fml::Mapping > snapshot_instructions)
 Loads the Dart shared library into the Dart VM. When the Dart library is loaded successfully, the Dart future returned by the originating loadLibrary() call completes.
 
virtual void LoadDartDeferredLibraryError (intptr_t loading_unit_id, const std::string error_message, bool transient)
 Indicates to the dart VM that the request to load a deferred library with the specified loading unit id has failed.
 
virtual void UpdateAssetResolverByType (std::unique_ptr< AssetResolver > updated_asset_resolver, AssetResolver::AssetResolverType type)
 Replaces the asset resolver handled by the engine's AssetManager of the specified type with updated_asset_resolver. The matching AssetResolver is removed and replaced with updated_asset_resolvers.
 
virtual std::unique_ptr< SnapshotSurfaceProducerCreateSnapshotSurfaceProducer ()
 Creates an object that produces surfaces suitable for raster snapshotting. The rasterizer will request this surface if no on screen surface is currently available when an application requests a snapshot, e.g. if Scene.toImage or Picture.toImage are called while the application is in the background.
 
const SettingsGetSettings () const
 Get the settings for this platform view instance.
 
virtual double GetScaledFontSize (double unscaled_font_size, int configuration_id) const
 Synchronously invokes platform-specific APIs to apply the system text scaling on the given unscaled font size.
 
virtual void RequestViewFocusChange (const ViewFocusChangeRequest &request)
 Notifies the client that the Flutter view focus state has changed and the platform view should be updated.
 
virtual void SetupImpellerContext ()
 Performs any deferred setup of the Impeller context.
 

Additional Inherited Members

- Public Types inherited from flutter::PlatformView
using AddViewCallback = std::function< void(bool added)>
 
using RemoveViewCallback = std::function< void(bool removed)>
 
- Protected Attributes inherited from flutter::PlatformView
PlatformView::Delegatedelegate_
 
const TaskRunners task_runners_
 
fml::WeakPtrFactory< PlatformViewweak_factory_
 

Detailed Description

A bridge connecting the platform agnostic shell and the iOS embedding.

The shell provides and requests for UI related data and this PlatformView subclass fulfills it with iOS specific capabilities. As an example, the iOS embedding (the FlutterEngine and the FlutterViewController) sends pointer data to the shell and receives the shell's request for a Impeller AiksContext and supplies it.

Despite the name "view", this class is unrelated to UIViews on iOS and doesn't have the same lifecycle. It's a long lived bridge owned by the FlutterEngine and can be attached and detached sequentially to multiple FlutterViewControllers and FlutterViews.

Definition at line 40 of file platform_view_ios.h.

Constructor & Destructor Documentation

◆ PlatformViewIOS() [1/2]

flutter::PlatformViewIOS::PlatformViewIOS ( PlatformView::Delegate delegate,
const std::shared_ptr< IOSContext > &  context,
__weak FlutterPlatformViewsController platform_views_controller,
const flutter::TaskRunners task_runners 
)

Definition at line 22 of file platform_view_ios.mm.

26 : PlatformView(delegate, task_runners),
27 ios_context_(context),
28 platform_views_controller_(platform_views_controller),
29 platform_message_handler_(
30 new PlatformMessageHandlerIos(task_runners.GetPlatformTaskRunner())) {}
PlatformView(Delegate &delegate, const TaskRunners &task_runners)
Creates a platform view with the specified delegate and task runner. The base class by itself does no...
fml::RefPtr< fml::TaskRunner > GetPlatformTaskRunner() const

◆ PlatformViewIOS() [2/2]

flutter::PlatformViewIOS::PlatformViewIOS ( PlatformView::Delegate delegate,
IOSRenderingAPI  rendering_api,
__weak FlutterPlatformViewsController platform_views_controller,
const flutter::TaskRunners task_runners,
const std::shared_ptr< fml::ConcurrentTaskRunner > &  worker_task_runner,
const std::shared_ptr< const fml::SyncSwitch > &  is_gpu_disabled_sync_switch 
)
explicit

Definition at line 32 of file platform_view_ios.mm.

39 : PlatformViewIOS(delegate,
40 IOSContext::Create(rendering_api,
41 delegate.OnPlatformViewGetSettings().enable_impeller
44 is_gpu_disabled_sync_switch,
45 delegate.OnPlatformViewGetSettings()),
46 platform_views_controller,
47 task_runners) {}
static std::unique_ptr< IOSContext > Create(IOSRenderingAPI api, IOSRenderingBackend backend, const std::shared_ptr< const fml::SyncSwitch > &is_gpu_disabled_sync_switch, const Settings &settings)
Create an iOS context object capable of creating the on-screen and off-screen GPU context for use by ...
PlatformViewIOS(PlatformView::Delegate &delegate, const std::shared_ptr< IOSContext > &context, __weak FlutterPlatformViewsController *platform_views_controller, const flutter::TaskRunners &task_runners)

◆ ~PlatformViewIOS()

flutter::PlatformViewIOS::~PlatformViewIOS ( )
overridedefault

Member Function Documentation

◆ attachView()

void flutter::PlatformViewIOS::attachView ( )

Called one time per FlutterViewController when the FlutterViewController's UIView is first loaded.

Can be used to perform late initialization after FlutterViewController's init.

Definition at line 92 of file platform_view_ios.mm.

92 {
93 FML_DCHECK(owner_controller_);
94 FML_DCHECK(owner_controller_.isViewLoaded) << "FlutterViewController's view should be loaded "
95 "before attaching to PlatformViewIOS.";
96 FlutterView* flutter_view = static_cast<FlutterView*>(owner_controller_.view);
97 CALayer* ca_layer = flutter_view.layer;
98 ios_surface_ = IOSSurface::Create(ios_context_, ca_layer);
99 FML_DCHECK(ios_surface_ != nullptr);
100
101 if (accessibility_bridge_) {
102 accessibility_bridge_ = std::make_unique<AccessibilityBridge>(
103 owner_controller_, this, owner_controller_.platformViewsController);
104 }
105}
static std::unique_ptr< IOSSurface > Create(std::shared_ptr< IOSContext > context, CALayer *layer)
#define FML_DCHECK(condition)
Definition logging.h:122

References flutter::IOSSurface::Create(), FML_DCHECK, and flutter::FlutterViewController::view().

Referenced by SetOwnerViewController().

◆ ComputePlatformResolvedLocales()

std::unique_ptr< std::vector< std::string > > flutter::PlatformViewIOS::ComputePlatformResolvedLocales ( const std::vector< std::string > &  supported_locale_data)
overridevirtual

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.

Reimplemented from flutter::PlatformView.

Definition at line 202 of file platform_view_ios.mm.

203 {
204 size_t localeDataLength = 3;
205 NSMutableArray<NSString*>* supported_locale_identifiers =
206 [NSMutableArray arrayWithCapacity:supported_locale_data.size() / localeDataLength];
207 for (size_t i = 0; i < supported_locale_data.size(); i += localeDataLength) {
208 NSDictionary<NSString*, NSString*>* dict = @{
209 NSLocaleLanguageCode : [NSString stringWithUTF8String:supported_locale_data[i].c_str()]
210 ?: @"",
211 NSLocaleCountryCode : [NSString stringWithUTF8String:supported_locale_data[i + 1].c_str()]
212 ?: @"",
213 NSLocaleScriptCode : [NSString stringWithUTF8String:supported_locale_data[i + 2].c_str()]
214 ?: @""
215 };
216 [supported_locale_identifiers addObject:[NSLocale localeIdentifierFromComponents:dict]];
217 }
218 NSArray<NSString*>* result =
219 [NSBundle preferredLocalizationsFromArray:supported_locale_identifiers];
220
221 // Output format should be either empty or 3 strings for language, country, and script.
222 std::unique_ptr<std::vector<std::string>> out = std::make_unique<std::vector<std::string>>();
223
224 if (result != nullptr && [result count] > 0) {
225 NSLocale* locale = [NSLocale localeWithLocaleIdentifier:[result firstObject]];
226 NSString* languageCode = [locale languageCode];
227 out->emplace_back(languageCode == nullptr ? "" : languageCode.UTF8String);
228 NSString* countryCode = [locale countryCode];
229 out->emplace_back(countryCode == nullptr ? "" : countryCode.UTF8String);
230 NSString* scriptCode = [locale scriptCode];
231 out->emplace_back(scriptCode == nullptr ? "" : scriptCode.UTF8String);
232 }
233 return out;
234}

References i.

◆ CreateExternalViewEmbedder()

std::shared_ptr< ExternalViewEmbedder > flutter::PlatformViewIOS::CreateExternalViewEmbedder ( )
overridevirtual

Reimplemented from flutter::PlatformView.

Definition at line 131 of file platform_view_ios.mm.

131 {
132 return std::make_shared<IOSExternalViewEmbedder>(platform_views_controller_, ios_context_);
133}

◆ CreateRenderingSurface()

std::unique_ptr< Surface > flutter::PlatformViewIOS::CreateRenderingSurface ( )
overridevirtual

Reimplemented from flutter::PlatformView.

Definition at line 119 of file platform_view_ios.mm.

119 {
121 std::lock_guard<std::mutex> guard(ios_surface_mutex_);
122 if (!ios_surface_) {
123 FML_DLOG(INFO) << "Could not CreateRenderingSurface, this PlatformViewIOS "
124 "has no ViewController.";
125 return nullptr;
126 }
127 return ios_surface_->CreateGPUSurface();
128}
const TaskRunners task_runners_
fml::RefPtr< fml::TaskRunner > GetRasterTaskRunner() const
virtual bool RunsTasksOnCurrentThread()
#define FML_DLOG(severity)
Definition logging.h:121

References FML_DCHECK, FML_DLOG, flutter::TaskRunners::GetRasterTaskRunner(), fml::TaskRunner::RunsTasksOnCurrentThread(), and flutter::PlatformView::task_runners_.

◆ CreateVSyncWaiter()

std::unique_ptr< VsyncWaiter > flutter::PlatformViewIOS::CreateVSyncWaiter ( )
overridevirtual

Invoked by the shell to obtain a platform specific vsync waiter. It is optional for platforms to override this method and provide a custom vsync waiter because a timer based fall-back waiter is used by default. However, it is highly recommended that platform provide their own Vsync waiter as the timer based fall-back will not render frames aligned with vsync boundaries.

Attention
If a timer based fall-back is used, a warning is logged to the console. In case this method is overridden in a subclass, it must return a valid vsync waiter. Returning null will lead to internal errors. If a valid vsync waiter cannot be returned, subclasses should just call the based class method instead.
Returns
A vsync waiter. If is an internal error to return a null waiter.

Reimplemented from flutter::PlatformView.

Definition at line 184 of file platform_view_ios.mm.

184 {
185 return std::make_unique<VsyncWaiterIOS>(task_runners_);
186}

References flutter::PlatformView::task_runners_.

◆ GetAccessibilityBridge()

AccessibilityBridge * flutter::PlatformViewIOS::GetAccessibilityBridge ( )
inline

Gets the accessibility bridge created in this platform view.

Definition at line 141 of file platform_view_ios.h.

141{ return accessibility_bridge_.get(); }

◆ GetDispatcherMaker()

PointerDataDispatcherMaker flutter::PlatformViewIOS::GetDispatcherMaker ( )
overridevirtual

Returns a platform-specific PointerDataDispatcherMaker so the Engine can construct the PointerDataPacketDispatcher based on platforms.

Reimplemented from flutter::PlatformView.

Definition at line 107 of file platform_view_ios.mm.

107 {
108 return [](DefaultPointerDataDispatcher::Delegate& delegate) {
109 return std::make_unique<SmoothPointerDataDispatcher>(delegate);
110 };
111}

◆ GetImpellerContext()

std::shared_ptr< impeller::Context > flutter::PlatformViewIOS::GetImpellerContext ( ) const
overridevirtual

Reimplemented from flutter::PlatformView.

Definition at line 136 of file platform_view_ios.mm.

136 {
137 return ios_context_->GetImpellerContext();
138}

◆ GetIosContext()

const std::shared_ptr< IOSContext > & flutter::PlatformViewIOS::GetIosContext ( )
inline

Accessor for the IOSContext associated with the platform view.

Definition at line 128 of file platform_view_ios.h.

128{ return ios_context_; }

◆ GetOwnerViewController()

FlutterViewController * flutter::PlatformViewIOS::GetOwnerViewController ( ) const

Returns the FlutterViewController currently attached to the FlutterEngine owning this PlatformViewIOS.

Definition at line 56 of file platform_view_ios.mm.

56 {
57 return owner_controller_;
58}

◆ GetPlatformMessageHandler()

std::shared_ptr< PlatformMessageHandler > flutter::PlatformViewIOS::GetPlatformMessageHandler ( ) const
inlineoverridevirtual

Specifies a delegate that will receive PlatformMessages from Flutter to the host platform.

If this returns null that means PlatformMessages should be sent to the PlatformView. That is to protect legacy behavior, any embedder that wants to support executing Platform Channel handlers on background threads should be returning a thread-safe PlatformMessageHandler instead.

Reimplemented from flutter::PlatformView.

Definition at line 134 of file platform_view_ios.h.

134 {
135 return platform_message_handler_;
136 }

◆ GetPlatformMessageHandlerIos()

std::shared_ptr< PlatformMessageHandlerIos > flutter::PlatformViewIOS::GetPlatformMessageHandlerIos ( ) const
inline

Definition at line 130 of file platform_view_ios.h.

130 {
131 return platform_message_handler_;
132 }

◆ HandlePlatformMessage()

void flutter::PlatformViewIOS::HandlePlatformMessage ( std::unique_ptr< flutter::PlatformMessage message)
override

Definition at line 52 of file platform_view_ios.mm.

52 {
53 platform_message_handler_->HandlePlatformMessage(std::move(message));
54}
G_BEGIN_DECLS GBytes * message

References message.

◆ OnPreEngineRestart()

void flutter::PlatformViewIOS::OnPreEngineRestart ( ) const
overridevirtual

Gives embedders a chance to react to a "cold restart" of the running isolate. The default implementation of this method does nothing.

While a "hot restart" patches a running isolate, a "cold restart" restarts the root isolate in a running shell.

Reimplemented from flutter::PlatformView.

Definition at line 189 of file platform_view_ios.mm.

189 {
190 if (accessibility_bridge_) {
191 accessibility_bridge_.get()->clearState();
192 }
193 if (!owner_controller_) {
194 return;
195 }
196 [owner_controller_.platformViewsController reset];
197 [owner_controller_.restorationPlugin reset];
198 [owner_controller_.textInputPlugin reset];
199}

◆ RegisterExternalTexture()

void flutter::PlatformViewIOS::RegisterExternalTexture ( int64_t  id,
NSObject< FlutterTexture > *  texture 
)

Called through when an external texture such as video or camera is given to the FlutterEngine or FlutterViewController.

Definition at line 113 of file platform_view_ios.mm.

114 {
115 RegisterTexture(ios_context_->CreateExternalTexture(texture_id, texture));
116}
void RegisterTexture(std::shared_ptr< flutter::Texture > texture)
Used by the embedder to specify a texture that it wants the rasterizer to composite within the Flutte...
FlTexture * texture
int64_t texture_id

References flutter::PlatformView::RegisterTexture(), texture, and texture_id.

◆ SetAccessibilityFeatures()

void flutter::PlatformViewIOS::SetAccessibilityFeatures ( int32_t  flags)
overridevirtual

Used by the embedder to specify the features to enable in the accessibility tree generated by the isolate. This information is forwarded to the root isolate hosted by the engine on the UI thread.

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.

Attention
Subclasses may choose to override this method to perform platform specific functions. However, they must call the base class method at some point in their implementation.
Parameters
[in]flagsThe features to enable in the accessibility tree.

Reimplemented from flutter::PlatformView.

Definition at line 146 of file platform_view_ios.mm.

146 {
148}
virtual void SetAccessibilityFeatures(int32_t flags)
Used by the embedder to specify the features to enable in the accessibility tree generated by the iso...

References flutter::PlatformView::SetAccessibilityFeatures().

◆ SetApplicationLocale()

void flutter::PlatformViewIOS::SetApplicationLocale ( std::string  locale)
overridevirtual

Used by the framework to set application locale in the embedding.

Parameters
[in]localeThe application locale in BCP 47 format.

Reimplemented from flutter::PlatformView.

Definition at line 164 of file platform_view_ios.mm.

164 {
165 application_locale_ = std::move(locale);
166 ApplyLocaleToOwnerController();
167}

◆ SetOwnerViewController()

void flutter::PlatformViewIOS::SetOwnerViewController ( __weak FlutterViewController owner_controller)

Updates the FlutterViewController currently attached to the FlutterEngine owning this PlatformViewIOS. This should be updated when the FlutterEngine is given a new FlutterViewController.

Definition at line 60 of file platform_view_ios.mm.

60 {
62 std::lock_guard<std::mutex> guard(ios_surface_mutex_);
63 if (ios_surface_ || !owner_controller) {
65 ios_surface_.reset();
66 accessibility_bridge_.reset();
67 }
68 owner_controller_ = owner_controller;
69 ApplyLocaleToOwnerController();
70
71 // Add an observer that will clear out the owner_controller_ ivar and
72 // the accessibility_bridge_ in case the view controller is deleted.
73 dealloc_view_controller_observer_.reset([[NSNotificationCenter defaultCenter]
74 addObserverForName:FlutterViewControllerWillDealloc
75 object:owner_controller_
76 queue:[NSOperationQueue mainQueue]
77 usingBlock:^(NSNotification* note) {
78 // Implicit copy of 'this' is fine.
79 accessibility_bridge_.reset();
80 owner_controller_ = nil;
81 }]);
82
83 if (owner_controller_ && owner_controller_.isViewLoaded) {
84 this->attachView();
85 }
86 // Do not call `NotifyCreated()` here - let FlutterViewController take care
87 // of that when its Viewport is sized. If `NotifyCreated()` is called here,
88 // it can occasionally get invoked before the viewport is sized resulting in
89 // a framebuffer that will not be able to completely attach.
90}
virtual void NotifyDestroyed()
Used by embedders to notify the shell that the platform view has been destroyed. This notification us...
VkQueue queue
Definition main.cc:71
NSNotificationName const FlutterViewControllerWillDealloc

References attachView(), FlutterViewControllerWillDealloc, FML_DCHECK, flutter::TaskRunners::GetPlatformTaskRunner(), flutter::PlatformView::NotifyDestroyed(), queue, fml::TaskRunner::RunsTasksOnCurrentThread(), and flutter::PlatformView::task_runners_.

◆ SetSemanticsEnabled()

void flutter::PlatformViewIOS::SetSemanticsEnabled ( bool  enabled)
overridevirtual

Used by embedder to notify the running isolate hosted by the engine on the UI thread that the accessibility tree needs to be generated.

Attention
Subclasses may choose to override this method to perform platform specific functions. However, they must call the base class method at some point in their implementation.
Parameters
[in]enabledWhether the accessibility tree needs to be generated.

Reimplemented from flutter::PlatformView.

Definition at line 141 of file platform_view_ios.mm.

141 {
143}
virtual void SetSemanticsEnabled(bool enabled)
Used by embedder to notify the running isolate hosted by the engine on the UI thread that the accessi...

References flutter::PlatformView::SetSemanticsEnabled().

◆ SetSemanticsTreeEnabled()

void flutter::PlatformViewIOS::SetSemanticsTreeEnabled ( bool  enabled)
overridevirtual

Used by the framework to tell the embedder to prepare or clear resoruce for accepting semantics tree.

Parameters
[in]enabledwhether framework starts or stops sending semantics updates

Reimplemented from flutter::PlatformView.

Definition at line 170 of file platform_view_ios.mm.

170 {
171 FML_DCHECK(owner_controller_);
172 if (enabled) {
173 if (accessibility_bridge_) {
174 return;
175 }
176 accessibility_bridge_ =
177 std::make_unique<AccessibilityBridge>(owner_controller_, this, platform_views_controller_);
178 } else {
179 accessibility_bridge_.reset();
180 }
181}

References FML_DCHECK.

◆ UpdateSemantics()

void flutter::PlatformViewIOS::UpdateSemantics ( int64_t  view_id,
flutter::SemanticsNodeUpdates  updates,
flutter::CustomAccessibilityActionUpdates  actions 
)
overridevirtual

Used by the framework to tell the embedder to apply the specified semantics node updates. The default implementation of this method does nothing.

See also
SemanticsNode, SemticsNodeUpdates, CustomAccessibilityActionUpdates
Parameters
[in]view_idThe ID of the view that this update is for
[in]updatesA map with the stable semantics node identifier as key and the node properties as the value.
[in]actionsA map with the stable semantics node identifier as key and the custom node action as the value.

Reimplemented from flutter::PlatformView.

Definition at line 151 of file platform_view_ios.mm.

153 {
154 FML_DCHECK(owner_controller_);
155 FML_DCHECK(accessibility_bridge_);
156 if (accessibility_bridge_) {
157 accessibility_bridge_.get()->UpdateSemantics(std::move(update), actions);
158 [[NSNotificationCenter defaultCenter] postNotificationName:FlutterSemanticsUpdateNotification
159 object:owner_controller_];
160 }
161}
FLUTTER_DARWIN_EXPORT NSNotificationName const FlutterSemanticsUpdateNotification

References FlutterSemanticsUpdateNotification, and FML_DCHECK.


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