Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
platform_view.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SHELL_COMMON_PLATFORM_VIEW_H_
6#define FLUTTER_SHELL_COMMON_PLATFORM_VIEW_H_
7
8#include <functional>
9#include <memory>
10
15#include "flutter/fml/macros.h"
16#include "flutter/fml/mapping.h"
27#include "third_party/skia/include/gpu/ganesh/GrDirectContext.h"
28
29namespace impeller {
30
31class Context;
32
33} // namespace impeller
34
35namespace flutter {
36
37//------------------------------------------------------------------------------
38/// @brief Platform views are created by the shell on the platform task
39/// runner. Unless explicitly specified, all platform view methods
40/// are called on the platform task runner as well. Platform views
41/// are usually sub-classed on a per platform basis and the bulk of
42/// the window system integration happens using that subclass. Since
43/// most platform window toolkits are usually only safe to access on
44/// a single "main" thread, any interaction that requires access to
45/// the underlying platform's window toolkit is routed through the
46/// platform view associated with that shell. This involves
47/// operations like settings up and tearing down the render surface,
48/// platform messages, interacting with accessibility features on
49/// the platform, input events, etc.
50///
52 public:
53 using AddViewCallback = std::function<void(bool added)>;
54 using RemoveViewCallback = std::function<void(bool removed)>;
55 //----------------------------------------------------------------------------
56 /// @brief Used to forward events from the platform view to interested
57 /// subsystems. This forwarding is done by the shell which sets
58 /// itself up as the delegate of the platform view.
59 ///
60 class Delegate {
61 public:
64 using KeyDataResponse = std::function<void(bool)>;
65 //--------------------------------------------------------------------------
66 /// @brief Notifies the delegate that the platform view was created
67 /// with the given render surface. This surface is platform
68 /// (iOS, Android) and client-rendering API (OpenGL, Software,
69 /// Metal, Vulkan) specific. This is usually a sign to the
70 /// rasterizer to set up and begin rendering to that surface.
71 ///
72 /// @param[in] surface The surface
73 ///
74 virtual void OnPlatformViewCreated(std::unique_ptr<Surface> surface) = 0;
75
76 //--------------------------------------------------------------------------
77 /// @brief Notifies the delegate that the platform view was destroyed.
78 /// This is usually a sign to the rasterizer to suspend
79 /// rendering a previously configured surface and collect any
80 /// intermediate resources.
81 ///
82 virtual void OnPlatformViewDestroyed() = 0;
83
84 //--------------------------------------------------------------------------
85 /// @brief Notifies the delegate that the platform needs to schedule a
86 /// frame to regenerate the layer tree and redraw the surface.
87 ///
88 virtual void OnPlatformViewScheduleFrame() = 0;
89
90 /// @brief Allocate resources for a new non-implicit view and inform
91 /// Dart about the view, and on success, schedules a new frame.
92 ///
93 /// After the operation, |callback| should be invoked with whether
94 /// the operation is successful.
95 ///
96 /// Adding |kFlutterImplicitViewId| or an existing view ID should
97 /// result in failure.
98 ///
99 /// @param[in] view_id The view ID of the new view.
100 /// @param[in] viewport_metrics The initial viewport metrics for the view.
101 /// @param[in] callback The callback that's invoked once the shell
102 /// has attempted to add the view.
103 ///
104 virtual void OnPlatformViewAddView(int64_t view_id,
105 const ViewportMetrics& viewport_metrics,
107
108 /// @brief Deallocate resources for a removed view and inform
109 /// Dart about the removal.
110 ///
111 /// After the operation, |callback| should be invoked with whether
112 /// the operation is successful.
113 ///
114 /// Removing |kFlutterImplicitViewId| or an non-existent view ID
115 /// should result in failure.
116 ///
117 /// @param[in] view_id The view ID of the view to be removed.
118 /// @param[in] callback The callback that's invoked once the shell has
119 /// attempted to remove the view.
120 ///
121 virtual void OnPlatformViewRemoveView(int64_t view_id,
123
124 /// @brief Notify the delegate that platform view focus state has changed.
125 ///
126 /// @param[in] event The focus event describing the change.
128 const ViewFocusEvent& event) = 0;
129
130 //--------------------------------------------------------------------------
131 /// @brief Notifies the delegate that the specified callback needs to
132 /// be invoked after the rasterizer is done rendering the next
133 /// frame. This callback will be called on the render thread and
134 /// it is caller responsibility to perform any re-threading as
135 /// necessary. Due to the asynchronous nature of rendering in
136 /// Flutter, embedders usually add a placeholder over the
137 /// contents in which Flutter is going to render when Flutter is
138 /// first initialized. This callback may be used as a signal to
139 /// remove that placeholder.
140 ///
141 /// @attention The callback will be invoked on the render thread and not
142 /// the calling thread.
143 ///
144 /// @param[in] closure The callback to execute on the next frame.
145 ///
147 const fml::closure& closure) = 0;
148
149 //--------------------------------------------------------------------------
150 /// @brief Notifies the delegate the viewport metrics of a view have
151 /// been updated. The rasterizer will need to be reconfigured to
152 /// render the frame in the updated viewport metrics.
153 ///
154 /// @param[in] view_id The ID for the view that `metrics` describes.
155 /// @param[in] metrics The updated viewport metrics.
156 ///
158 int64_t view_id,
159 const ViewportMetrics& metrics) = 0;
160
161 //--------------------------------------------------------------------------
162 /// @brief Notifies the delegate that the platform has dispatched a
163 /// platform message from the embedder to the Flutter
164 /// application. This message must be forwarded to the running
165 /// isolate hosted by the engine on the UI thread.
166 ///
167 /// @param[in] message The platform message to dispatch to the running
168 /// root isolate.
169 ///
171 std::unique_ptr<PlatformMessage> message) = 0;
172
173 //--------------------------------------------------------------------------
174 /// @brief Notifies the delegate that the platform view has encountered
175 /// a pointer event. This pointer event needs to be forwarded to
176 /// the running root isolate hosted by the engine on the UI
177 /// thread.
178 ///
179 /// @param[in] packet The pointer data packet containing multiple pointer
180 /// events.
181 ///
183 std::unique_ptr<PointerDataPacket> packet) = 0;
184
185 //--------------------------------------------------------------------------
186 /// @brief Requests the delegate to perform framework hit test from the
187 /// engine.
188 /// This API must be called from the UI thread.
189 /// Calling this from the platform thread causes
190 /// undefined behavior if the UI and platform threads
191 /// are not merged.
192 /// @param[in] view_id The identifier of the flutter view that
193 /// should be hit tested.
194 /// @param[in] offset The position in the view that should be hit tested.
195 ///
196 /// @return The hit test response.
197 ///
199 int64_t view_id,
200 const flutter::PointData offset) = 0;
201
202 //--------------------------------------------------------------------------
203 /// @brief Notifies the delegate that the platform view has encountered
204 /// an accessibility related action on the specified node. This
205 /// event must be forwarded to the running root isolate hosted
206 /// by the engine on the UI thread.
207 ///
208 /// @param[in] view_id The identifier of the view that contains this node.
209 /// @param[in] node_id The identifier of the accessibility node.
210 /// @param[in] action The accessibility related action performed on the
211 /// node of the specified ID.
212 /// @param[in] args An optional list of argument that apply to the
213 /// specified action.
214 ///
216 int64_t view_id,
217 int32_t node_id,
220
221 //--------------------------------------------------------------------------
222 /// @brief Notifies the delegate that the embedder has expressed an
223 /// opinion about whether the accessibility tree needs to be
224 /// enabled or disabled. This information needs to be forwarded
225 /// to the root isolate running on the UI thread.
226 ///
227 /// @param[in] enabled Whether the accessibility tree is enabled or
228 /// disabled.
229 ///
230 virtual void OnPlatformViewSetSemanticsEnabled(bool enabled) = 0;
231
232 //--------------------------------------------------------------------------
233 /// @brief Notifies the delegate that the embedder has expressed an
234 /// opinion about the features to enable in the accessibility
235 /// tree.
236 ///
237 /// The engine does not care about the accessibility feature
238 /// flags as all it does is forward this information from the
239 /// embedder to the framework. However, curious readers may
240 /// refer to `AccessibilityFeatures` in `window.dart` for
241 /// currently supported accessibility feature flags.
242 ///
243 /// @param[in] flags The features to enable in the accessibility tree.
244 ///
245 virtual void OnPlatformViewSetAccessibilityFeatures(int32_t flags) = 0;
246
247 //--------------------------------------------------------------------------
248 /// @brief Notifies the delegate that the embedder has specified a
249 /// texture that it want the rasterizer to composite within the
250 /// Flutter layer tree. All textures must have a unique
251 /// identifier. When the rasterizer encounters an external
252 /// texture within its hierarchy, it gives the embedder a chance
253 /// to update that texture on the raster thread before it
254 /// composites the same on-screen.
255 ///
256 /// @param[in] texture The texture that is being updated by the embedder
257 /// but composited by Flutter in its own hierarchy.
258 ///
260 std::shared_ptr<Texture> texture) = 0;
261
262 //--------------------------------------------------------------------------
263 /// @brief Notifies the delegate that the embedder will no longer
264 /// attempt to composite the specified texture within the layer
265 /// tree. This allows the rasterizer to collect associated
266 /// resources.
267 ///
268 /// @param[in] texture_id The identifier of the texture to unregister. If
269 /// the texture has not been previously registered,
270 /// this call does nothing.
271 ///
273
274 //--------------------------------------------------------------------------
275 /// @brief Notifies the delegate that the embedder has updated the
276 /// contents of the texture with the specified identifier.
277 /// Typically, Flutter will only render a frame if there is an
278 /// updated layer tree. However, in cases where the layer tree
279 /// is static but one of the externally composited textures has
280 /// been updated by the embedder, the embedder needs to notify
281 /// the rasterizer to render a new frame. In such cases, the
282 /// existing layer tree may be reused with the frame composited
283 /// with all updated external textures.
284 ///
285 /// @param[in] texture_id The identifier of the texture that has been
286 /// updated.
287 ///
289 int64_t texture_id) = 0;
290
291 //--------------------------------------------------------------------------
292 /// @brief Loads the dart shared library into the dart VM. When the
293 /// dart library is loaded successfully, the dart future
294 /// returned by the originating loadLibrary() call completes.
295 ///
296 /// The Dart compiler may generate separate shared libraries
297 /// files called 'loading units' when libraries are imported
298 /// as deferred. Each of these shared libraries are identified
299 /// by a unique loading unit id. Callers should open and resolve
300 /// a SymbolMapping from the shared library. The Mappings should
301 /// be moved into this method, as ownership will be assumed by
302 /// the dart root isolate after successful loading and released
303 /// after shutdown of the root isolate. The loading unit may not
304 /// be used after isolate shutdown. If loading fails, the
305 /// mappings will be released.
306 ///
307 /// This method is paired with a RequestDartDeferredLibrary
308 /// invocation that provides the embedder with the loading unit
309 /// id of the deferred library to load.
310 ///
311 ///
312 /// @param[in] loading_unit_id The unique id of the deferred library's
313 /// loading unit.
314 ///
315 /// @param[in] snapshot_data Dart snapshot data of the loading unit's
316 /// shared library.
317 ///
318 /// @param[in] snapshot_data Dart snapshot instructions of the loading
319 /// unit's shared library.
320 ///
322 intptr_t loading_unit_id,
323 std::unique_ptr<const fml::Mapping> snapshot_data,
324 std::unique_ptr<const fml::Mapping> snapshot_instructions) = 0;
325
326 //--------------------------------------------------------------------------
327 /// @brief Indicates to the dart VM that the request to load a deferred
328 /// library with the specified loading unit id has failed.
329 ///
330 /// The dart future returned by the initiating loadLibrary()
331 /// call will complete with an error.
332 ///
333 /// @param[in] loading_unit_id The unique id of the deferred library's
334 /// loading unit, as passed in by
335 /// RequestDartDeferredLibrary.
336 ///
337 /// @param[in] error_message The error message that will appear in the
338 /// dart Future.
339 ///
340 /// @param[in] transient A transient error is a failure due to
341 /// temporary conditions such as no network.
342 /// Transient errors allow the dart VM to
343 /// re-request the same deferred library and
344 /// loading_unit_id again. Non-transient
345 /// errors are permanent and attempts to
346 /// re-request the library will instantly
347 /// complete with an error.
348 virtual void LoadDartDeferredLibraryError(intptr_t loading_unit_id,
349 const std::string error_message,
350 bool transient) = 0;
351
352 //--------------------------------------------------------------------------
353 /// @brief Replaces the asset resolver handled by the engine's
354 /// AssetManager of the specified `type` with
355 /// `updated_asset_resolver`. The matching AssetResolver is
356 /// removed and replaced with `updated_asset_resolvers`.
357 ///
358 /// AssetResolvers should be updated when the existing resolver
359 /// becomes obsolete and a newer one becomes available that
360 /// provides updated access to the same type of assets as the
361 /// existing one. This update process is meant to be performed
362 /// at runtime.
363 ///
364 /// If a null resolver is provided, nothing will be done. If no
365 /// matching resolver is found, the provided resolver will be
366 /// added to the end of the AssetManager resolvers queue. The
367 /// replacement only occurs with the first matching resolver.
368 /// Any additional matching resolvers are untouched.
369 ///
370 /// @param[in] updated_asset_resolver The asset resolver to replace the
371 /// resolver of matching type with.
372 ///
373 /// @param[in] type The type of AssetResolver to update. Only resolvers of
374 /// the specified type will be replaced by the updated
375 /// resolver.
376 ///
378 std::unique_ptr<AssetResolver> updated_asset_resolver,
380
381 //--------------------------------------------------------------------------
382 /// @brief Called by the platform view on the platform thread to get
383 /// the settings object associated with the platform view
384 /// instance.
385 ///
386 /// @return The settings.
387 ///
388 virtual const Settings& OnPlatformViewGetSettings() const = 0;
389 };
390
391 //----------------------------------------------------------------------------
392 /// @brief Creates a platform view with the specified delegate and task
393 /// runner. The base class by itself does not do much but is
394 /// suitable for use in test environments where full platform
395 /// integration may not be necessary. The platform view may only
396 /// be created, accessed and destroyed on the platform task
397 /// runner.
398 ///
399 /// @param delegate The delegate. This is typically the shell.
400 /// @param[in] task_runners The task runners used by this platform view.
401 ///
402 explicit PlatformView(Delegate& delegate, const TaskRunners& task_runners);
403
404 //----------------------------------------------------------------------------
405 /// @brief Destroys the platform view. The platform view is owned by the
406 /// shell and will be destroyed by the same on the platform tasks
407 /// runner.
408 ///
409 virtual ~PlatformView();
410
411 //----------------------------------------------------------------------------
412 /// @brief Invoked by the shell to obtain a platform specific vsync
413 /// waiter. It is optional for platforms to override this method
414 /// and provide a custom vsync waiter because a timer based
415 /// fall-back waiter is used by default. However, it is highly
416 /// recommended that platform provide their own Vsync waiter as
417 /// the timer based fall-back will not render frames aligned with
418 /// vsync boundaries.
419 ///
420 /// @attention If a timer based fall-back is used, a warning is logged to the
421 /// console. In case this method is overridden in a subclass, it
422 /// must return a valid vsync waiter. Returning null will lead to
423 /// internal errors. If a valid vsync waiter cannot be returned,
424 /// subclasses should just call the based class method instead.
425 ///
426 /// @return A vsync waiter. If is an internal error to return a null
427 /// waiter.
428 ///
429 virtual std::unique_ptr<VsyncWaiter> CreateVSyncWaiter();
430
431 //----------------------------------------------------------------------------
432 /// @brief Used by embedders to dispatch a platform message to a
433 /// running root isolate hosted by the engine. If an isolate is
434 /// not running, the message is dropped. If there is no one on the
435 /// other side listening on the channel, the message is dropped.
436 /// When a platform message is dropped, any response handles
437 /// associated with that message will be dropped as well. All
438 /// users of platform messages must assume that message may not be
439 /// delivered and/or their response handles may not be invoked.
440 /// Platform messages are not buffered.
441 ///
442 /// For embedders that wish to respond to platform message
443 /// directed from the framework to the embedder, the
444 /// `HandlePlatformMessage` method may be overridden.
445 ///
446 /// @see HandlePlatformMessage()
447 ///
448 /// @param[in] message The platform message to deliver to the root isolate.
449 ///
450 void DispatchPlatformMessage(std::unique_ptr<PlatformMessage> message);
451
452 //----------------------------------------------------------------------------
453 /// @brief Overridden by embedders to perform actions in response to
454 /// platform messages sent from the framework to the embedder.
455 /// Default implementation of this method simply returns an empty
456 /// response.
457 ///
458 /// Embedders that wish to send platform messages to the framework
459 /// may use the `DispatchPlatformMessage` method. This method is
460 /// for messages that go the other way.
461 ///
462 /// @see DispatchPlatformMessage()
463 ///
464 /// @param[in] message The message
465 ///
466 virtual void HandlePlatformMessage(std::unique_ptr<PlatformMessage> message);
467
468 //----------------------------------------------------------------------------
469 /// @brief Used by embedders to dispatch an accessibility action to a
470 /// running isolate hosted by the engine.
471 ///
472 /// @param[in] view_id The identifier of the view.
473 /// @param[in] node_id The identifier of the accessibility node on which to
474 /// perform the action.
475 /// @param[in] action The action
476 /// @param[in] args The arguments
477 ///
478 void DispatchSemanticsAction(int64_t view_id,
479 int32_t node_id,
482
483 //----------------------------------------------------------------------------
484 /// @brief Used by embedder to notify the running isolate hosted by the
485 /// engine on the UI thread that the accessibility tree needs to
486 /// be generated.
487 ///
488 /// @attention Subclasses may choose to override this method to perform
489 /// platform specific functions. However, they must call the base
490 /// class method at some point in their implementation.
491 ///
492 /// @param[in] enabled Whether the accessibility tree needs to be generated.
493 ///
494 virtual void SetSemanticsEnabled(bool enabled);
495
496 //----------------------------------------------------------------------------
497 /// @brief Used by the embedder to specify the features to enable in the
498 /// accessibility tree generated by the isolate. This information
499 /// is forwarded to the root isolate hosted by the engine on the
500 /// UI thread.
501 ///
502 /// The engine does not care about the accessibility feature flags
503 /// as all it does is forward this information from the embedder
504 /// to the framework. However, curious readers may refer to
505 /// `AccessibilityFeatures` in `window.dart` for currently
506 /// supported accessibility feature flags.
507 ///
508 /// @attention Subclasses may choose to override this method to perform
509 /// platform specific functions. However, they must call the base
510 /// class method at some point in their implementation.
511 ///
512 /// @param[in] flags The features to enable in the accessibility tree.
513 ///
514 virtual void SetAccessibilityFeatures(int32_t flags);
515
516 //----------------------------------------------------------------------------
517 /// @brief Used by the framework to tell the embedder to apply the
518 /// specified semantics node updates. The default implementation
519 /// of this method does nothing.
520 ///
521 /// @see SemanticsNode, SemticsNodeUpdates,
522 /// CustomAccessibilityActionUpdates
523 ///
524 /// @param[in] view_id The ID of the view that this update is for
525 /// @param[in] updates A map with the stable semantics node identifier as
526 /// key and the node properties as the value.
527 /// @param[in] actions A map with the stable semantics node identifier as
528 /// key and the custom node action as the value.
529 ///
530 virtual void UpdateSemantics(int64_t view_id,
531 SemanticsNodeUpdates updates,
533
534 //----------------------------------------------------------------------------
535 /// @brief Used by the framework to set application locale in the
536 /// embedding
537 ///
538 /// @param[in] locale The application locale in BCP 47 format.
539 ///
540 virtual void SetApplicationLocale(std::string locale);
541
542 //----------------------------------------------------------------------------
543 /// @brief Used by the framework to tell the embedder to prepare or clear
544 /// resoruce for accepting semantics tree.
545 ///
546 /// @param[in] enabled whether framework starts or stops sending semantics
547 /// updates
548 ///
549 virtual void SetSemanticsTreeEnabled(bool enabled);
550
551 //----------------------------------------------------------------------------
552 /// @brief Used by the framework to tell the embedder that it has
553 /// registered a listener on a given channel.
554 ///
555 /// @param[in] name The name of the channel on which the listener has
556 /// set or cleared a listener.
557 /// @param[in] listening True if a listener has been set, false if it has
558 /// been cleared.
559 ///
560 virtual void SendChannelUpdate(const std::string& name, bool listening);
561
562 //----------------------------------------------------------------------------
563 /// @brief Used by embedders to specify the updated viewport metrics for
564 /// a view. In response to this call, on the raster thread, the
565 /// rasterizer may need to be reconfigured to the updated viewport
566 /// dimensions. On the UI thread, the framework may need to start
567 /// generating a new frame for the updated viewport metrics as
568 /// well.
569 ///
570 /// @param[in] view_id The ID for the view that `metrics` describes.
571 /// @param[in] metrics The updated viewport metrics.
572 ///
573 void SetViewportMetrics(int64_t view_id, const ViewportMetrics& metrics);
574
575 //----------------------------------------------------------------------------
576 /// @brief Used by embedders to notify the shell that a platform view
577 /// has been created. This notification is used to create a
578 /// rendering surface and pick the client rendering API to use to
579 /// render into this surface. No frames will be scheduled or
580 /// rendered before this call. The surface must remain valid till
581 /// the corresponding call to NotifyDestroyed.
582 ///
583 void NotifyCreated();
584
585 //----------------------------------------------------------------------------
586 /// @brief Used by embedders to notify the shell that the platform view
587 /// has been destroyed. This notification used to collect the
588 /// rendering surface and all associated resources. Frame
589 /// scheduling is also suspended.
590 ///
591 /// @attention Subclasses may choose to override this method to perform
592 /// platform specific functions. However, they must call the base
593 /// class method at some point in their implementation.
594 ///
595 virtual void NotifyDestroyed();
596
597 //----------------------------------------------------------------------------
598 /// @brief Used by embedders to schedule a frame. In response to this
599 /// call, the framework may need to start generating a new frame.
600 ///
601 void ScheduleFrame();
602
603 /// @brief Used by embedders to notify the shell of a new non-implicit view.
604 ///
605 /// This method notifies the shell to allocate resources and inform
606 /// Dart about the view, and on success, schedules a new frame.
607 /// Finally, it invokes |callback| with whether the operation is
608 /// successful.
609 ///
610 /// This operation is asynchronous; avoid using the view until
611 /// |callback| returns true. Callers should prepare resources for the
612 /// view (if any) in advance but be ready to clean up on failure.
613 ///
614 /// The callback is called on a different thread.
615 ///
616 /// Do not use for implicit views, which are added internally during
617 /// shell initialization. Adding |kFlutterImplicitViewId| or an
618 /// existing view ID will fail, indicated by |callback| returning
619 /// false.
620 ///
621 /// @param[in] view_id The view ID of the new view.
622 /// @param[in] viewport_metrics The initial viewport metrics for the view.
623 /// @param[in] callback The callback that's invoked once the shell
624 /// has attempted to add the view.
625 ///
626 void AddView(int64_t view_id,
627 const ViewportMetrics& viewport_metrics,
629
630 /// @brief Used by embedders to notify the shell of a removed non-implicit
631 /// view.
632 ///
633 /// This method notifies the shell to deallocate resources and inform
634 /// Dart about the removal. Finally, it invokes |callback| with
635 /// whether the operation is successful.
636 ///
637 /// This operation is asynchronous. The embedder should not deallocate
638 /// resources until the |callback| is invoked.
639 ///
640 /// The callback is called on a different thread.
641 ///
642 /// Do not use for implicit views, which are never removed throughout
643 /// the lifetime of the app.
644 /// Removing |kFlutterImplicitViewId| or an
645 /// non-existent view ID will fail, indicated by |callback| returning
646 /// false.
647 ///
648 /// @param[in] view_id The view ID of the view to be removed.
649 /// @param[in] callback The callback that's invoked once the shell has
650 /// attempted to remove the view.
651 ///
653
654 void SendViewFocusEvent(const ViewFocusEvent& event);
655
656 //----------------------------------------------------------------------------
657 /// @brief Used by the shell to obtain a Skia GPU context that is capable
658 /// of operating on the IO thread. The context must be in the same
659 /// share-group as the Skia GPU context used on the render thread.
660 /// This context will always be used on the IO thread. Because it
661 /// is in the same share-group as the separate render thread
662 /// context, any GPU resources uploaded in this context will be
663 /// visible to the render thread context (synchronization of GPU
664 /// resources is managed by Skia).
665 ///
666 /// If such context cannot be created on the IO thread, callers
667 /// may return `nullptr`. This will mean that all texture uploads
668 /// will be queued onto the render thread which will cause
669 /// performance issues. When this context is `nullptr`, an error
670 /// is logged to the console. It is highly recommended that all
671 /// platforms provide a resource context.
672 ///
673 /// @attention Unlike all other methods on the platform view, this will be
674 /// called on IO task runner.
675 ///
676 /// @return The Skia GPU context that is in the same share-group as the
677 /// main render thread GPU context. May be `nullptr` in case such
678 /// a context cannot be created.
679 ///
680 virtual sk_sp<GrDirectContext> CreateResourceContext() const;
681
682 virtual std::shared_ptr<impeller::Context> GetImpellerContext() const;
683
684 //----------------------------------------------------------------------------
685 /// @brief Used by the shell to notify the embedder that the resource
686 /// context previously obtained via a call to
687 /// `CreateResourceContext()` is being collected. The embedder
688 /// is free to collect an platform specific resources
689 /// associated with this context.
690 ///
691 /// @attention Unlike all other methods on the platform view, this will be
692 /// called on IO task runner.
693 ///
694 virtual void ReleaseResourceContext() const;
695
696 //--------------------------------------------------------------------------
697 /// @brief Returns a platform-specific PointerDataDispatcherMaker so the
698 /// `Engine` can construct the PointerDataPacketDispatcher based
699 /// on platforms.
701
702 //----------------------------------------------------------------------------
703 /// @brief Returns a weak pointer to the platform view. Since the
704 /// platform view may only be created, accessed and destroyed
705 /// on the platform thread, any access to the platform view
706 /// from a non-platform task runner needs a weak pointer to
707 /// the platform view along with a reference to the platform
708 /// task runner. A task must be posted to the platform task
709 /// runner with the weak pointer captured in the same. The
710 /// platform view method may only be called in the posted task
711 /// once the weak pointer validity has been checked. This
712 /// method is used by callers to obtain that weak pointer.
713 ///
714 /// @return The weak pointer to the platform view.
715 ///
717
718 //----------------------------------------------------------------------------
719 /// @brief Gives embedders a chance to react to a "cold restart" of the
720 /// running isolate. The default implementation of this method
721 /// does nothing.
722 ///
723 /// While a "hot restart" patches a running isolate, a "cold
724 /// restart" restarts the root isolate in a running shell.
725 ///
726 virtual void OnPreEngineRestart() const;
727
728 //----------------------------------------------------------------------------
729 /// @brief Sets a callback that gets executed when the rasterizer renders
730 /// the next frame. Due to the asynchronous nature of
731 /// rendering in Flutter, embedders usually add a placeholder
732 /// over the contents in which Flutter is going to render when
733 /// Flutter is first initialized. This callback may be used as
734 /// a signal to remove that placeholder. The callback is
735 /// executed on the render task runner and not the platform
736 /// task runner. It is the embedder's responsibility to
737 /// re-thread as necessary.
738 ///
739 /// @attention The callback is executed on the render task runner and not the
740 /// platform task runner. Embedders must re-thread as necessary.
741 ///
742 /// @param[in] closure The callback to execute on the render thread when the
743 /// next frame gets rendered.
744 ///
745 void SetNextFrameCallback(const fml::closure& closure);
746
747 //----------------------------------------------------------------------------
748 /// @brief Dispatches pointer events from the embedder to the
749 /// framework. Each pointer data packet may contain multiple
750 /// pointer input events. Each call to this method wakes up
751 /// the UI thread.
752 ///
753 /// @param[in] packet The pointer data packet to dispatch to the framework.
754 ///
755 void DispatchPointerDataPacket(std::unique_ptr<PointerDataPacket> packet);
756
757 //----------------------------------------------------------------------------
758 /// @brief Requests to perform framework hit test from the engine.
759 ///
760 /// @param[in] view_id The identifier of the flutter view that
761 /// should be hit tested.
762 /// @param[in] offset The position in the view that should be hit tested.
763 ///
764 /// @return The hit test response.
765 ///
766 HitTestResponse HitTest(int64_t view_id, const flutter::PointData offset);
767
768 //--------------------------------------------------------------------------
769 /// @brief Used by the embedder to specify a texture that it wants the
770 /// rasterizer to composite within the Flutter layer tree. All
771 /// textures must have a unique identifier. When the
772 /// rasterizer encounters an external texture within its
773 /// hierarchy, it gives the embedder a chance to update that
774 /// texture on the raster thread before it composites the same
775 /// on-screen.
776 ///
777 /// @attention This method must only be called once per texture. When the
778 /// texture is updated, calling `MarkTextureFrameAvailable`
779 /// with the specified texture identifier is sufficient to
780 /// make Flutter re-render the frame with the updated texture
781 /// composited in-line.
782 ///
783 /// @see UnregisterTexture, MarkTextureFrameAvailable
784 ///
785 /// @param[in] texture The texture that is being updated by the embedder
786 /// but composited by Flutter in its own hierarchy.
787 ///
788 void RegisterTexture(std::shared_ptr<flutter::Texture> texture);
789
790 //--------------------------------------------------------------------------
791 /// @brief Used by the embedder to notify the rasterizer that it will
792 /// no longer attempt to composite the specified texture within
793 /// the layer tree. This allows the rasterizer to collect
794 /// associated resources.
795 ///
796 /// @attention This call must only be called once per texture identifier.
797 ///
798 /// @see RegisterTexture, MarkTextureFrameAvailable
799 ///
800 /// @param[in] texture_id The identifier of the texture to unregister. If
801 /// the texture has not been previously registered,
802 /// this call does nothing.
803 ///
804 void UnregisterTexture(int64_t texture_id);
805
806 //--------------------------------------------------------------------------
807 /// @brief Used by the embedder to notify the rasterizer that the context
808 /// of the previously registered texture have been updated.
809 /// Typically, Flutter will only render a frame if there is an
810 /// updated layer tree. However, in cases where the layer tree
811 /// is static but one of the externally composited textures
812 /// has been updated by the embedder, the embedder needs to
813 /// notify the rasterizer to render a new frame. In such
814 /// cases, the existing layer tree may be reused with the
815 /// frame re-composited with all updated external textures.
816 /// Unlike the calls to register and unregister the texture,
817 /// this call must be made each time a new texture frame is
818 /// available.
819 ///
820 /// @see RegisterTexture, UnregisterTexture
821 ///
822 /// @param[in] texture_id The identifier of the texture that has been
823 /// updated.
824 ///
826
827 //--------------------------------------------------------------------------
828 /// @brief Directly invokes platform-specific APIs to compute the
829 /// locale the platform would have natively resolved to.
830 ///
831 /// @param[in] supported_locale_data The vector of strings that represents
832 /// the locales supported by the app.
833 /// Each locale consists of three
834 /// strings: languageCode, countryCode,
835 /// and scriptCode in that order.
836 ///
837 /// @return A vector of 3 strings languageCode, countryCode, and
838 /// scriptCode that represents the locale selected by the
839 /// platform. Empty strings mean the value was unassigned. Empty
840 /// vector represents a null locale.
841 ///
842 virtual std::unique_ptr<std::vector<std::string>>
844 const std::vector<std::string>& supported_locale_data);
845
846 virtual std::shared_ptr<ExternalViewEmbedder> CreateExternalViewEmbedder();
847
848 //--------------------------------------------------------------------------
849 /// @brief Invoked when the dart VM requests that a deferred library
850 /// be loaded. Notifies the engine that the deferred library
851 /// identified by the specified loading unit id should be
852 /// downloaded and loaded into the Dart VM via
853 /// `LoadDartDeferredLibrary`
854 ///
855 /// Upon encountering errors or otherwise failing to load a
856 /// loading unit with the specified id, the failure should be
857 /// directly reported to dart by calling
858 /// `LoadDartDeferredLibraryFailure` to ensure the waiting dart
859 /// future completes with an error.
860 ///
861 /// @param[in] loading_unit_id The unique id of the deferred library's
862 /// loading unit. This id is to be passed
863 /// back into LoadDartDeferredLibrary
864 /// in order to identify which deferred
865 /// library to load.
866 ///
867 virtual void RequestDartDeferredLibrary(intptr_t loading_unit_id);
868
869 //--------------------------------------------------------------------------
870 /// @brief Loads the Dart shared library into the Dart VM. When the
871 /// Dart library is loaded successfully, the Dart future
872 /// returned by the originating loadLibrary() call completes.
873 ///
874 /// The Dart compiler may generate separate shared libraries
875 /// files called 'loading units' when libraries are imported
876 /// as deferred. Each of these shared libraries are identified
877 /// by a unique loading unit id. Callers should open and resolve
878 /// a SymbolMapping from the shared library. The Mappings should
879 /// be moved into this method, as ownership will be assumed by the
880 /// dart isolate after successful loading and released after
881 /// shutdown of the dart isolate. If loading fails, the mappings
882 /// will naturally go out of scope.
883 ///
884 /// This method is paired with a RequestDartDeferredLibrary
885 /// invocation that provides the embedder with the loading unit id
886 /// of the deferred library to load.
887 ///
888 ///
889 /// @param[in] loading_unit_id The unique id of the deferred library's
890 /// loading unit, as passed in by
891 /// RequestDartDeferredLibrary.
892 ///
893 /// @param[in] snapshot_data Dart snapshot data of the loading unit's
894 /// shared library.
895 ///
896 /// @param[in] snapshot_data Dart snapshot instructions of the loading
897 /// unit's shared library.
898 ///
899 virtual void LoadDartDeferredLibrary(
900 intptr_t loading_unit_id,
901 std::unique_ptr<const fml::Mapping> snapshot_data,
902 std::unique_ptr<const fml::Mapping> snapshot_instructions);
903
904 //--------------------------------------------------------------------------
905 /// @brief Indicates to the dart VM that the request to load a deferred
906 /// library with the specified loading unit id has failed.
907 ///
908 /// The dart future returned by the initiating loadLibrary() call
909 /// will complete with an error.
910 ///
911 /// @param[in] loading_unit_id The unique id of the deferred library's
912 /// loading unit, as passed in by
913 /// RequestDartDeferredLibrary.
914 ///
915 /// @param[in] error_message The error message that will appear in the
916 /// dart Future.
917 ///
918 /// @param[in] transient A transient error is a failure due to
919 /// temporary conditions such as no network.
920 /// Transient errors allow the dart VM to
921 /// re-request the same deferred library and
922 /// loading_unit_id again. Non-transient
923 /// errors are permanent and attempts to
924 /// re-request the library will instantly
925 /// complete with an error.
926 ///
927 virtual void LoadDartDeferredLibraryError(intptr_t loading_unit_id,
928 const std::string error_message,
929 bool transient);
930
931 //--------------------------------------------------------------------------
932 /// @brief Replaces the asset resolver handled by the engine's
933 /// AssetManager of the specified `type` with
934 /// `updated_asset_resolver`. The matching AssetResolver is
935 /// removed and replaced with `updated_asset_resolvers`.
936 ///
937 /// AssetResolvers should be updated when the existing resolver
938 /// becomes obsolete and a newer one becomes available that
939 /// provides updated access to the same type of assets as the
940 /// existing one. This update process is meant to be performed
941 /// at runtime.
942 ///
943 /// If a null resolver is provided, nothing will be done. If no
944 /// matching resolver is found, the provided resolver will be
945 /// added to the end of the AssetManager resolvers queue. The
946 /// replacement only occurs with the first matching resolver.
947 /// Any additional matching resolvers are untouched.
948 ///
949 /// @param[in] updated_asset_resolver The asset resolver to replace the
950 /// resolver of matching type with.
951 ///
952 /// @param[in] type The type of AssetResolver to update. Only resolvers of
953 /// the specified type will be replaced by the updated
954 /// resolver.
955 ///
956 virtual void UpdateAssetResolverByType(
957 std::unique_ptr<AssetResolver> updated_asset_resolver,
959
960 //--------------------------------------------------------------------------
961 /// @brief Creates an object that produces surfaces suitable for raster
962 /// snapshotting. The rasterizer will request this surface if no
963 /// on screen surface is currently available when an application
964 /// requests a snapshot, e.g. if `Scene.toImage` or
965 /// `Picture.toImage` are called while the application is in the
966 /// background.
967 ///
968 /// Not all backends support this kind of surface usage, and the
969 /// default implementation returns nullptr. Platforms should
970 /// override this if they can support GPU operations in the
971 /// background and support GPU resource context usage.
972 ///
973 virtual std::unique_ptr<SnapshotSurfaceProducer>
975
976 //--------------------------------------------------------------------------
977 /// @brief Specifies a delegate that will receive PlatformMessages from
978 /// Flutter to the host platform.
979 ///
980 /// @details If this returns `null` that means PlatformMessages should be sent
981 /// to the PlatformView. That is to protect legacy behavior, any embedder
982 /// that wants to support executing Platform Channel handlers on background
983 /// threads should be returning a thread-safe PlatformMessageHandler instead.
984 virtual std::shared_ptr<PlatformMessageHandler> GetPlatformMessageHandler()
985 const;
986
987 //----------------------------------------------------------------------------
988 /// @brief Get the settings for this platform view instance.
989 ///
990 /// @return The settings.
991 ///
992 const Settings& GetSettings() const;
993
994 //--------------------------------------------------------------------------
995 /// @brief Synchronously invokes platform-specific APIs to apply the
996 /// system text scaling on the given unscaled font size.
997 ///
998 /// Platforms that support this feature (currently it's only
999 /// implemented for Android SDK level 34+) will send a valid
1000 /// configuration_id to potential callers, before this method can
1001 /// be called.
1002 ///
1003 /// @param[in] unscaled_font_size The unscaled font size specified by the
1004 /// app developer. The value is in logical
1005 /// pixels, and is guaranteed to be finite and
1006 /// non-negative.
1007 /// @param[in] configuration_id The unique id of the configuration to use
1008 /// for computing the scaled font size.
1009 ///
1010 /// @return The scaled font size in logical pixels, or -1 if the given
1011 /// configuration_id did not match a valid configuration.
1012 ///
1013 virtual double GetScaledFontSize(double unscaled_font_size,
1014 int configuration_id) const;
1015
1016 //--------------------------------------------------------------------------
1017 /// @brief Notifies the client that the Flutter view focus state has
1018 /// changed and the platform view should be updated.
1019 ///
1020 /// Called on platform thread.
1021 ///
1022 /// @param[in] request The request to change the focus state of the view.
1023 virtual void RequestViewFocusChange(const ViewFocusChangeRequest& request);
1024
1025 //--------------------------------------------------------------------------
1026 /// @brief Performs any deferred setup of the Impeller context
1027 ///
1028 /// This is intended to be called from the raster thread so that
1029 /// Impeller context creation can be moved off the startup path.
1030 virtual void SetupImpellerContext() {}
1031
1032 protected:
1033 // This is the only method called on the raster task runner.
1034 virtual std::unique_ptr<Surface> CreateRenderingSurface();
1035
1039
1040 private:
1042};
1043
1044} // namespace flutter
1045
1046#endif // FLUTTER_SHELL_COMMON_PLATFORM_VIEW_H_
AssetResolverType
Identifies the type of AssetResolver an instance is.
Used to forward events from the platform view to interested subsystems. This forwarding is done by th...
virtual void OnPlatformViewAddView(int64_t view_id, const ViewportMetrics &viewport_metrics, AddViewCallback callback)=0
Allocate resources for a new non-implicit view and inform Dart about the view, and on success,...
virtual void OnPlatformViewSetNextFrameCallback(const fml::closure &closure)=0
Notifies the delegate that the specified callback needs to be invoked after the rasterizer is done re...
virtual void OnPlatformViewDispatchSemanticsAction(int64_t view_id, int32_t node_id, SemanticsAction action, fml::MallocMapping args)=0
Notifies the delegate that the platform view has encountered an accessibility related action on the s...
virtual void UpdateAssetResolverByType(std::unique_ptr< AssetResolver > updated_asset_resolver, AssetResolver::AssetResolverType type)=0
Replaces the asset resolver handled by the engine's AssetManager of the specified type with updated_a...
virtual void OnPlatformViewUnregisterTexture(int64_t texture_id)=0
Notifies the delegate that the embedder will no longer attempt to composite the specified texture wit...
virtual HitTestResponse OnPlatformViewHitTest(int64_t view_id, const flutter::PointData offset)=0
Requests the delegate to perform framework hit test from the engine. This API must be called from the...
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 compos...
virtual void OnPlatformViewDispatchPointerDataPacket(std::unique_ptr< PointerDataPacket > packet)=0
Notifies the delegate that the platform view has encountered a pointer event. This pointer event need...
virtual void OnPlatformViewRemoveView(int64_t view_id, RemoveViewCallback callback)=0
Deallocate resources for a removed view and inform Dart about the removal.
virtual void OnPlatformViewSetViewportMetrics(int64_t view_id, const ViewportMetrics &metrics)=0
Notifies the delegate the viewport metrics of a view have been updated. The rasterizer will need to b...
virtual void OnPlatformViewSetAccessibilityFeatures(int32_t flags)=0
Notifies the delegate that the embedder has expressed an opinion about the features to enable in the ...
virtual void OnPlatformViewSendViewFocusEvent(const ViewFocusEvent &event)=0
Notify the delegate that platform view focus state has changed.
virtual void OnPlatformViewSetSemanticsEnabled(bool enabled)=0
Notifies the delegate that the embedder has expressed an opinion about whether the accessibility tree...
virtual void OnPlatformViewCreated(std::unique_ptr< Surface > surface)=0
Notifies the delegate that the platform view was created with the given render surface....
virtual const Settings & OnPlatformViewGetSettings() const =0
Called by the platform view on the platform thread to get the settings object associated with the pla...
std::function< void(bool)> KeyDataResponse
virtual void OnPlatformViewScheduleFrame()=0
Notifies the delegate that the platform needs to schedule a frame to regenerate the layer tree and re...
PlatformView::AddViewCallback AddViewCallback
virtual void LoadDartDeferredLibrary(intptr_t loading_unit_id, std::unique_ptr< const fml::Mapping > snapshot_data, std::unique_ptr< const fml::Mapping > snapshot_instructions)=0
Loads the dart shared library into the dart VM. When the dart library is loaded successfully,...
virtual void OnPlatformViewDestroyed()=0
Notifies the delegate that the platform view was destroyed. This is usually a sign to the rasterizer ...
virtual void LoadDartDeferredLibraryError(intptr_t loading_unit_id, const std::string error_message, bool transient)=0
Indicates to the dart VM that the request to load a deferred library with the specified loading unit ...
virtual void OnPlatformViewDispatchPlatformMessage(std::unique_ptr< PlatformMessage > message)=0
Notifies the delegate that the platform has dispatched a platform message from the embedder to the Fl...
virtual void OnPlatformViewMarkTextureFrameAvailable(int64_t texture_id)=0
Notifies the delegate that the embedder has updated the contents of the texture with the specified id...
PlatformView::RemoveViewCallback RemoveViewCallback
Platform views are created by the shell on the platform task runner. Unless explicitly specified,...
virtual void NotifyDestroyed()
Used by embedders to notify the shell that the platform view has been destroyed. This notification us...
virtual void RequestViewFocusChange(const ViewFocusChangeRequest &request)
Notifies the client that the Flutter view focus state has changed and the platform view should be upd...
std::function< void(bool removed)> RemoveViewCallback
void SetNextFrameCallback(const fml::closure &closure)
Sets a callback that gets executed when the rasterizer renders the next frame. Due to the asynchronou...
virtual void SetSemanticsEnabled(bool enabled)
Used by embedder to notify the running isolate hosted by the engine on the UI thread that the accessi...
virtual std::shared_ptr< PlatformMessageHandler > GetPlatformMessageHandler() const
Specifies a delegate that will receive PlatformMessages from Flutter to the host platform.
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...
virtual void HandlePlatformMessage(std::unique_ptr< PlatformMessage > message)
Overridden by embedders to perform actions in response to platform messages sent from the framework t...
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....
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 f...
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 ~PlatformView()
Destroys the platform view. The platform view is owned by the shell and will be destroyed by the same...
virtual PointerDataDispatcherMaker GetDispatcherMaker()
Returns a platform-specific PointerDataDispatcherMaker so the Engine can construct the PointerDataPac...
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,...
virtual void SetSemanticsTreeEnabled(bool enabled)
Used by the framework to tell the embedder to prepare or clear resoruce for accepting semantics tree.
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,...
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_a...
const Settings & GetSettings() const
Get the settings for this platform view instance.
std::function< void(bool added)> AddViewCallback
virtual void SetApplicationLocale(std::string locale)
Used by the framework to set application locale in the embedding.
void DispatchPlatformMessage(std::unique_ptr< PlatformMessage > message)
Used by embedders to dispatch a platform message to a running root isolate hosted by the engine....
PlatformView::Delegate & delegate_
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 resolv...
HitTestResponse HitTest(int64_t view_id, const flutter::PointData offset)
Requests to perform framework hit test from the engine.
void NotifyCreated()
Used by embedders to notify the shell that a platform view has been created. This notification is use...
fml::WeakPtr< PlatformView > GetWeakPtr() const
Returns a weak pointer to the platform view. Since the platform view may only be created,...
virtual std::unique_ptr< SnapshotSurfaceProducer > CreateSnapshotSurfaceProducer()
Creates an object that produces surfaces suitable for raster snapshotting. The rasterizer will reques...
virtual void SetupImpellerContext()
Performs any deferred setup of the Impeller context.
void UnregisterTexture(int64_t texture_id)
Used by the embedder to notify the rasterizer that it will no longer attempt to composite the specifi...
virtual std::shared_ptr< ExternalViewEmbedder > CreateExternalViewEmbedder()
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 ...
virtual void OnPreEngineRestart() const
Gives embedders a chance to react to a "cold restart" of the running isolate. The default implementat...
virtual void ReleaseResourceContext() const
Used by the shell to notify the embedder that the resource context previously obtained via a call 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 def...
virtual std::unique_ptr< VsyncWaiter > CreateVSyncWaiter()
Invoked by the shell to obtain a platform specific vsync waiter. It is optional for platforms to over...
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 std::unique_ptr< Surface > CreateRenderingSurface()
virtual std::shared_ptr< impeller::Context > GetImpellerContext() const
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.
virtual void UpdateSemantics(int64_t view_id, SemanticsNodeUpdates updates, CustomAccessibilityActionUpdates actions)
Used by the framework to tell the embedder to apply the specified semantics node updates....
void SendViewFocusEvent(const ViewFocusEvent &event)
fml::WeakPtrFactory< PlatformView > weak_factory_
void DispatchPointerDataPacket(std::unique_ptr< PointerDataPacket > packet)
Dispatches pointer events from the embedder to the framework. Each pointer data packet may contain mu...
void RemoveView(int64_t view_id, RemoveViewCallback callback)
Used by embedders to notify the shell of a removed non-implicit view.
void ScheduleFrame()
Used by embedders to schedule a frame. In response to this call, the framework may need to start gene...
void MarkTextureFrameAvailable(int64_t texture_id)
Used by the embedder to notify the rasterizer that the context of the previously registered texture h...
const TaskRunners task_runners_
A Mapping like NonOwnedMapping, but uses Free as its release proc.
Definition mapping.h:144
const char * message
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
G_BEGIN_DECLS FlutterViewId view_id
FlutterDesktopBinaryReply callback
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
FlTexture * texture
std::unordered_map< int32_t, SemanticsNode > SemanticsNodeUpdates
std::unordered_map< int32_t, CustomAccessibilityAction > CustomAccessibilityActionUpdates
std::function< std::unique_ptr< PointerDataDispatcher >(PointerDataDispatcher::Delegate &)> PointerDataDispatcherMaker
Signature for constructing PointerDataDispatcher.
DEF_SWITCHES_START aot vmservice shared library name
Definition switch_defs.h:27
std::function< void()> closure
Definition closure.h:14
impeller::ShaderType type
int64_t texture_id