Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Member Functions | List of all members
flutter_runner::PlatformView Class Reference

#include <platform_view.h>

Inheritance diagram for flutter_runner::PlatformView:
flutter::PlatformView

Public Member Functions

 PlatformView (flutter::PlatformView::Delegate &delegate, flutter::TaskRunners task_runners, fuchsia::ui::views::ViewRef view_ref, std::shared_ptr< flutter::ExternalViewEmbedder > external_view_embedder, fuchsia::ui::input::ImeServiceHandle ime_service, fuchsia::ui::input3::KeyboardHandle keyboard, fuchsia::ui::pointer::TouchSourceHandle touch_source, fuchsia::ui::pointer::MouseSourceHandle mouse_source, fuchsia::ui::views::FocuserHandle focuser, fuchsia::ui::views::ViewRefFocusedHandle view_ref_focused, fuchsia::ui::composition::ParentViewportWatcherHandle parent_viewport_watcher, fuchsia::ui::pointerinjector::RegistryHandle pointerinjector_registry, OnEnableWireframeCallback wireframe_enabled_callback, OnCreateViewCallback on_create_view_callback, OnUpdateViewCallback on_update_view_callback, OnDestroyViewCallback on_destroy_view_callback, OnCreateSurfaceCallback on_create_surface_callback, OnSemanticsNodeUpdateCallback on_semantics_node_update_callback, OnRequestAnnounceCallback on_request_announce_callback, OnShaderWarmupCallback on_shader_warmup_callback, AwaitVsyncCallback await_vsync_callback, AwaitVsyncForSecondaryCallbackCallback await_vsync_for_secondary_callback_callback, std::shared_ptr< sys::ServiceDirectory > dart_application_svc)
 
 ~PlatformView () override
 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 OnGetLayout (fuchsia::ui::composition::LayoutInfo info)
 
void OnParentViewportStatus (fuchsia::ui::composition::ParentViewportStatus status)
 
void OnChildViewStatus (uint64_t content_id, fuchsia::ui::composition::ChildViewStatus status)
 
void OnChildViewViewRef (uint64_t content_id, uint64_t view_id, fuchsia::ui::views::ViewRef view_ref)
 
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.
 
std::shared_ptr< flutter::ExternalViewEmbedderCreateExternalViewEmbedder () override
 
- 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.
 
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.
 
void DispatchSemanticsAction (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 SetAccessibilityFeatures (int32_t flags)
 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.
 
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.
 
virtual sk_sp< GrDirectContextCreateResourceContext () 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 std::shared_ptr< impeller::ContextGetImpellerContext () const
 
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.
 
virtual PointerDataDispatcherMaker GetDispatcherMaker ()
 Returns a platform-specific PointerDataDispatcherMaker so the Engine can construct the PointerDataPacketDispatcher based on platforms.
 
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.
 
virtual void OnPreEngineRestart () const
 Gives embedders a chance to react to a "cold restart" of the running isolate. The default implementation of this method does nothing.
 
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 std::unique_ptr< std::vector< std::string > > ComputePlatformResolvedLocales (const std::vector< std::string > &supported_locale_data)
 Directly invokes platform-specific APIs to compute the locale the platform would have natively resolved to.
 
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.
 
virtual std::shared_ptr< PlatformMessageHandlerGetPlatformMessageHandler () const
 Specifies a delegate that will receive PlatformMessages from Flutter to the host platform.
 
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.
 

Private Member Functions

std::unique_ptr< flutter::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.
 
std::unique_ptr< flutter::SurfaceCreateRenderingSurface () override
 
void HandlePlatformMessage (std::unique_ptr< flutter::PlatformMessage > message) override
 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 UpdateSemantics (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.
 

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_
 
PointerDataPacketConverter pointer_data_packet_converter_
 
fml::WeakPtrFactory< PlatformViewweak_factory_
 

Detailed Description

Definition at line 71 of file platform_view.h.

Constructor & Destructor Documentation

◆ PlatformView()

PlatformView::PlatformView ( flutter::PlatformView::Delegate delegate,
flutter::TaskRunners  task_runners,
fuchsia::ui::views::ViewRef  view_ref,
std::shared_ptr< flutter::ExternalViewEmbedder external_view_embedder,
fuchsia::ui::input::ImeServiceHandle  ime_service,
fuchsia::ui::input3::KeyboardHandle  keyboard,
fuchsia::ui::pointer::TouchSourceHandle  touch_source,
fuchsia::ui::pointer::MouseSourceHandle  mouse_source,
fuchsia::ui::views::FocuserHandle  focuser,
fuchsia::ui::views::ViewRefFocusedHandle  view_ref_focused,
fuchsia::ui::composition::ParentViewportWatcherHandle  parent_viewport_watcher,
fuchsia::ui::pointerinjector::RegistryHandle  pointerinjector_registry,
OnEnableWireframeCallback  wireframe_enabled_callback,
OnCreateViewCallback  on_create_view_callback,
OnUpdateViewCallback  on_update_view_callback,
OnDestroyViewCallback  on_destroy_view_callback,
OnCreateSurfaceCallback  on_create_surface_callback,
OnSemanticsNodeUpdateCallback  on_semantics_node_update_callback,
OnRequestAnnounceCallback  on_request_announce_callback,
OnShaderWarmupCallback  on_shader_warmup_callback,
AwaitVsyncCallback  await_vsync_callback,
AwaitVsyncForSecondaryCallbackCallback  await_vsync_for_secondary_callback_callback,
std::shared_ptr< sys::ServiceDirectory >  dart_application_svc 
)

Definition at line 59 of file platform_view.cc.

85 : flutter::PlatformView(delegate, std::move(task_runners)),
86 external_view_embedder_(external_view_embedder),
87 focus_delegate_(
88 std::make_shared<FocusDelegate>(std::move(view_ref_focused),
89 std::move(focuser))),
90 pointer_delegate_(
91 std::make_shared<PointerDelegate>(std::move(touch_source),
92 std::move(mouse_source))),
93 wireframe_enabled_callback_(std::move(wireframe_enabled_callback)),
94 on_update_view_callback_(std::move(on_update_view_callback)),
95 on_create_surface_callback_(std::move(on_create_surface_callback)),
96 on_semantics_node_update_callback_(
97 std::move(on_semantics_node_update_callback)),
98 on_request_announce_callback_(std::move(on_request_announce_callback)),
99 on_create_view_callback_(std::move(on_create_view_callback)),
100 on_destroy_view_callback_(std::move(on_destroy_view_callback)),
101 on_shader_warmup_callback_(std::move(on_shader_warmup_callback)),
102 await_vsync_callback_(await_vsync_callback),
103 await_vsync_for_secondary_callback_callback_(
104 await_vsync_for_secondary_callback_callback),
105 dart_application_svc_(dart_application_svc),
106 parent_viewport_watcher_(parent_viewport_watcher.Bind()),
107 weak_factory_(this) {
108 fuchsia::ui::views::ViewRef view_ref_clone;
109 fidl::Clone(view_ref, &view_ref_clone);
110
111 text_delegate_ =
112 std::make_unique<TextDelegate>(
113 std::move(view_ref), std::move(ime_service), std::move(keyboard),
114 [weak = weak_factory_.GetWeakPtr()](
115 std::unique_ptr<flutter::PlatformMessage> message) {
116 if (!weak) {
117 FML_LOG(WARNING)
118 << "PlatformView use-after-free attempted. Ignoring.";
119 }
120 weak->delegate_.OnPlatformViewDispatchPlatformMessage(
121 std::move(message));
122 });
123
124 // Begin watching for focus changes.
125 focus_delegate_->WatchLoop([weak = weak_factory_.GetWeakPtr()](bool focused) {
126 if (!weak) {
127 FML_LOG(WARNING) << "PlatformView use-after-free attempted. Ignoring.";
128 return;
129 }
130
131 // Ensure last_text_state_ is set to make sure Flutter actually wants
132 // an IME.
133 if (focused && weak->text_delegate_->HasTextState()) {
134 weak->text_delegate_->ActivateIme();
135 } else if (!focused) {
136 weak->text_delegate_->DeactivateIme();
137 }
138 });
139
140 // Begin watching for pointer events.
141 pointer_delegate_->WatchLoop([weak = weak_factory_.GetWeakPtr()](
142 std::vector<flutter::PointerData> events) {
143 if (!weak) {
144 FML_LOG(WARNING) << "PlatformView use-after-free attempted. Ignoring.";
145 return;
146 }
147
148 if (events.empty()) {
149 return; // No work, bounce out.
150 }
151
152 // If pixel ratio hasn't been set, use a default value of 1.
153 const float pixel_ratio = weak->view_pixel_ratio_.value_or(1.f);
154 auto packet = std::make_unique<flutter::PointerDataPacket>(events.size());
155 for (size_t i = 0; i < events.size(); ++i) {
156 auto& event = events[i];
157 // Translate logical to physical coordinates, as per
158 // flutter::PointerData contract. Done here because pixel ratio comes
159 // from the graphics API.
160 event.physical_x = event.physical_x * pixel_ratio;
161 event.physical_y = event.physical_y * pixel_ratio;
162 packet->SetPointerData(i, event);
163 }
164 weak->DispatchPointerDataPacket(std::move(packet));
165 });
166
167 // Configure the pointer injector delegate.
168 pointer_injector_delegate_ = std::make_unique<PointerInjectorDelegate>(
169 std::move(pointerinjector_registry), std::move(view_ref_clone));
170
171 // This is only used by the integration tests.
172 if (dart_application_svc) {
173 // Connect to TouchInputListener
174 fuchsia::ui::test::input::TouchInputListenerHandle touch_input_listener;
175 zx_status_t touch_input_listener_status =
176 dart_application_svc
177 ->Connect<fuchsia::ui::test::input::TouchInputListener>(
178 touch_input_listener.NewRequest());
179 if (touch_input_listener_status != ZX_OK) {
180 FML_LOG(WARNING)
181 << "fuchsia::ui::test::input::TouchInputListener connection failed: "
182 << zx_status_get_string(touch_input_listener_status);
183 } else {
184 touch_input_listener_.Bind(std::move(touch_input_listener));
185 }
186
187 // Connect to KeyboardInputListener
188 fuchsia::ui::test::input::KeyboardInputListenerHandle
189 keyboard_input_listener;
190 zx_status_t keyboard_input_listener_status =
191 dart_application_svc
192 ->Connect<fuchsia::ui::test::input::KeyboardInputListener>(
193 keyboard_input_listener.NewRequest());
194 if (keyboard_input_listener_status != ZX_OK) {
195 FML_LOG(WARNING) << "fuchsia::ui::test::input::KeyboardInputListener "
196 "connection failed: "
197 << zx_status_get_string(keyboard_input_listener_status);
198 } else {
199 keyboard_input_listener_.Bind(std::move(keyboard_input_listener));
200 }
201 // Connect to MouseInputListener
202 fuchsia::ui::test::input::MouseInputListenerHandle mouse_input_listener;
203 zx_status_t mouse_input_listener_status =
204 dart_application_svc
205 ->Connect<fuchsia::ui::test::input::MouseInputListener>(
206 mouse_input_listener.NewRequest());
207 if (mouse_input_listener_status != ZX_OK) {
208 FML_LOG(WARNING)
209 << "fuchsia::ui::test::input::MouseInputListener connection failed: "
210 << zx_status_get_string(mouse_input_listener_status);
211 } else {
212 mouse_input_listener_.Bind(std::move(mouse_input_listener));
213 }
214 }
215
216 // Finally! Register the native platform message handlers.
217 RegisterPlatformMessageHandlers();
218
219 parent_viewport_watcher_.set_error_handler([](zx_status_t status) {
220 FML_LOG(ERROR) << "Interface error on: ParentViewportWatcher status: "
221 << status;
222 });
223
224 parent_viewport_watcher_->GetLayout(
225 fit::bind_member(this, &PlatformView::OnGetLayout));
226 parent_viewport_watcher_->GetStatus(
227 fit::bind_member(this, &PlatformView::OnParentViewportStatus));
228}
Platform views are created by the shell on the platform task runner. Unless explicitly specified,...
void OnGetLayout(fuchsia::ui::composition::LayoutInfo info)
void OnParentViewportStatus(fuchsia::ui::composition::ParentViewportStatus status)
FlKeyEvent * event
#define FML_LOG(severity)
Definition logging.h:82
Win32Message message
#define ERROR(message)

◆ ~PlatformView()

PlatformView::~PlatformView ( )
overridevirtualdefault

Destroys the platform view. The platform view is owned by the shell and will be destroyed by the same on the platform tasks runner.

Reimplemented from flutter::PlatformView.

Member Function Documentation

◆ CreateExternalViewEmbedder()

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

Reimplemented from flutter::PlatformView.

Definition at line 630 of file platform_view.cc.

630 {
631 return external_view_embedder_;
632}

◆ CreateRenderingSurface()

std::unique_ptr< flutter::Surface > PlatformView::CreateRenderingSurface ( )
overrideprivatevirtual

Reimplemented from flutter::PlatformView.

Definition at line 624 of file platform_view.cc.

624 {
625 return on_create_surface_callback_ ? on_create_surface_callback_() : nullptr;
626}

◆ CreateVSyncWaiter()

std::unique_ptr< flutter::VsyncWaiter > PlatformView::CreateVSyncWaiter ( )
overrideprivatevirtual

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 617 of file platform_view.cc.

617 {
618 return std::make_unique<flutter_runner::VsyncWaiter>(
619 await_vsync_callback_, await_vsync_for_secondary_callback_callback_,
621}
const TaskRunners task_runners_

◆ HandlePlatformMessage()

void PlatformView::HandlePlatformMessage ( std::unique_ptr< flutter::PlatformMessage message)
overrideprivatevirtual

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.

Embedders that wish to send platform messages to the framework may use the DispatchPlatformMessage method. This method is for messages that go the other way.

See also
DispatchPlatformMessage()
Parameters
[in]messageThe message

Reimplemented from flutter::PlatformView.

Definition at line 635 of file platform_view.cc.

636 {
637 if (!message) {
638 return;
639 }
640 const std::string channel = message->channel();
641 auto found = platform_message_handlers_.find(channel);
642 if (found == platform_message_handlers_.end()) {
643 const bool already_errored = unregistered_channels_.count(channel);
644 if (!already_errored) {
645 FML_LOG(INFO)
646 << "Platform view received message on channel '" << message->channel()
647 << "' with no registered handler. An empty response will be "
648 "generated. Please implement the native message handler. This "
649 "message will appear only once per channel.";
650 unregistered_channels_.insert(channel);
651 }
653 return;
654 }
655 auto response = message->response();
656 bool response_handled = found->second(std::move(message));
657
658 // Ensure all responses are completed.
659 if (response && !response_handled) {
660 // response_handled should be true if the response was completed.
661 FML_DCHECK(!response->is_complete());
662 response->CompleteEmpty();
663 }
664}
virtual void HandlePlatformMessage(std::unique_ptr< PlatformMessage > message)
Overridden by embedders to perform actions in response to platform messages sent from the framework t...
#define FML_DCHECK(condition)
Definition logging.h:103

◆ OnChildViewStatus()

void PlatformView::OnChildViewStatus ( uint64_t  content_id,
fuchsia::ui::composition::ChildViewStatus  status 
)

Definition at line 378 of file platform_view.cc.

380 {
381 FML_DCHECK(child_view_info_.count(content_id) == 1);
382
383 std::ostringstream out;
384 out << "{" << "\"method\":\"View.viewStateChanged\"," << "\"args\":{"
385 << " \"viewId\":" << child_view_info_.at(content_id).view_id
386 << "," // ViewId
387 << " \"is_rendering\":true," // IsViewRendering
388 << " \"state\":true" // IsViewRendering
389 << " }" << "}";
390 auto call = out.str();
391
392 std::unique_ptr<flutter::PlatformMessage> message =
393 std::make_unique<flutter::PlatformMessage>(
394 "flutter/platform_views",
395 fml::MallocMapping::Copy(call.c_str(), call.size()), nullptr);
397
398 child_view_info_.at(content_id)
399 .child_view_watcher->GetStatus(
400 [this, content_id](fuchsia::ui::composition::ChildViewStatus status) {
401 OnChildViewStatus(content_id, status);
402 });
403}
void DispatchPlatformMessage(std::unique_ptr< PlatformMessage > message)
Used by embedders to dispatch a platform message to a running root isolate hosted by the engine....
void OnChildViewStatus(uint64_t content_id, fuchsia::ui::composition::ChildViewStatus status)
static MallocMapping Copy(const T *begin, const T *end)
Definition mapping.h:162
call(args)
Definition dom.py:159

◆ OnChildViewViewRef()

void PlatformView::OnChildViewViewRef ( uint64_t  content_id,
uint64_t  view_id,
fuchsia::ui::views::ViewRef  view_ref 
)

Definition at line 405 of file platform_view.cc.

407 {
408 FML_CHECK(child_view_info_.count(content_id) == 1);
409
410 fuchsia::ui::views::ViewRef view_ref_clone;
411 fidl::Clone(view_ref, &view_ref_clone);
412
413 focus_delegate_->OnChildViewViewRef(view_id, std::move(view_ref));
414
415 pointer_injector_delegate_->OnCreateView(view_id, std::move(view_ref_clone));
416 OnChildViewConnected(content_id);
417}
#define FML_CHECK(condition)
Definition logging.h:85

◆ OnGetLayout()

void PlatformView::OnGetLayout ( fuchsia::ui::composition::LayoutInfo  info)

Definition at line 328 of file platform_view.cc.

328 {
329 view_logical_size_ = {static_cast<float>(info.logical_size().width),
330 static_cast<float>(info.logical_size().height)};
331
332 if (info.has_device_pixel_ratio()) {
333 // Both values should be identical for the Vec2 for DPR.
334 FML_DCHECK(info.device_pixel_ratio().x == info.device_pixel_ratio().y);
335 view_pixel_ratio_ = info.device_pixel_ratio().x;
336 }
337
338 float pixel_ratio = view_pixel_ratio_ ? *view_pixel_ratio_ : 1.0f;
340 pixel_ratio, // device_pixel_ratio
341 std::round(view_logical_size_.value()[0] *
342 pixel_ratio), // physical_width
343 std::round(view_logical_size_.value()[1] *
344 pixel_ratio), // physical_height
345 0.0f, // physical_padding_top
346 0.0f, // physical_padding_right
347 0.0f, // physical_padding_bottom
348 0.0f, // physical_padding_left
349 0.0f, // physical_view_inset_top
350 0.0f, // physical_view_inset_right
351 0.0f, // physical_view_inset_bottom
352 0.0f, // physical_view_inset_left
353 0.0f, // p_physical_system_gesture_inset_top
354 0.0f, // p_physical_system_gesture_inset_right
355 0.0f, // p_physical_system_gesture_inset_bottom
356 0.0f, // p_physical_system_gesture_inset_left,
357 -1.0, // p_physical_touch_slop,
358 {}, // p_physical_display_features_bounds
359 {}, // p_physical_display_features_type
360 {}, // p_physical_display_features_state
361 0, // p_display_id
362 };
364
365 parent_viewport_watcher_->GetLayout(
366 fit::bind_member(this, &PlatformView::OnGetLayout));
367}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
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,...
static constexpr int64_t kFlutterImplicitViewId

◆ OnParentViewportStatus()

void PlatformView::OnParentViewportStatus ( fuchsia::ui::composition::ParentViewportStatus  status)

Definition at line 369 of file platform_view.cc.

370 {
371 // TODO(fxbug.dev/116001): Investigate if it is useful to send hidden/shown
372 // signals.
373 parent_viewport_status_ = status;
374 parent_viewport_watcher_->GetStatus(
375 fit::bind_member(this, &PlatformView::OnParentViewportStatus));
376}

◆ SetSemanticsEnabled()

void PlatformView::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 667 of file platform_view.cc.

667 {
669 if (enabled) {
670 SetAccessibilityFeatures(static_cast<int32_t>(
672 } else {
674 }
675}
virtual void SetAccessibilityFeatures(int32_t flags)
Used by the embedder to specify the features to enable in the accessibility tree generated by the iso...
virtual void SetSemanticsEnabled(bool enabled)
Used by embedder to notify the running isolate hosted by the engine on the UI thread that the accessi...

◆ UpdateSemantics()

void PlatformView::UpdateSemantics ( flutter::SemanticsNodeUpdates  updates,
flutter::CustomAccessibilityActionUpdates  actions 
)
overrideprivatevirtual

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]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 678 of file platform_view.cc.

680 {
681 const float pixel_ratio =
682 view_pixel_ratio_.has_value() ? *view_pixel_ratio_ : 0.f;
683
684 on_semantics_node_update_callback_(update, pixel_ratio);
685}

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