Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
platform_configuration.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_LIB_UI_WINDOW_PLATFORM_CONFIGURATION_H_
6#define FLUTTER_LIB_UI_WINDOW_PLATFORM_CONFIGURATION_H_
7
8#include <functional>
9#include <memory>
10#include <string>
11#include <unordered_map>
12#include <vector>
13
14#include "flutter/assets/asset_manager.h"
15#include "flutter/fml/time/time_point.h"
16#include "flutter/lib/ui/semantics/semantics_update.h"
17#include "flutter/lib/ui/window/platform_message_response.h"
18#include "flutter/lib/ui/window/pointer_data_packet.h"
19#include "flutter/lib/ui/window/viewport_metrics.h"
20#include "flutter/shell/common/display.h"
23
24namespace flutter {
25class FontCollection;
26class PlatformMessage;
28class PlatformIsolateManager;
29class Scene;
30
31//--------------------------------------------------------------------------
32/// @brief An enum for defining the different kinds of accessibility features
33/// that can be enabled by the platform.
34///
35/// Must match the `AccessibilityFeatures` class in framework.
36enum class AccessibilityFeatureFlag : int32_t {
37 kAccessibleNavigation = 1 << 0,
38 kInvertColors = 1 << 1,
39 kDisableAnimations = 1 << 2,
40 kBoldText = 1 << 3,
41 kReduceMotion = 1 << 4,
42 kHighContrast = 1 << 5,
43 kOnOffSwitchLabels = 1 << 6,
44};
45
46//--------------------------------------------------------------------------
47/// @brief A client interface that the `RuntimeController` uses to define
48/// handlers for `PlatformConfiguration` requests.
49///
50/// @see `PlatformConfiguration`
51///
53 public:
54 //--------------------------------------------------------------------------
55 /// @brief The route or path that the embedder requested when the
56 /// application was launched.
57 ///
58 /// This will be the string "`/`" if no particular route was
59 /// requested.
60 ///
61 virtual std::string DefaultRouteName() = 0;
62
63 //--------------------------------------------------------------------------
64 /// @brief Requests that, at the next appropriate opportunity, a new
65 /// frame be scheduled for rendering.
66 ///
67 virtual void ScheduleFrame() = 0;
68
69 //--------------------------------------------------------------------------
70 /// @brief Called when a warm up frame has ended.
71 ///
72 /// For more introduction, see `Animator::EndWarmUpFrame`.
73 ///
74 virtual void EndWarmUpFrame() = 0;
75
76 //--------------------------------------------------------------------------
77 /// @brief Updates the client's rendering on the GPU with the newly
78 /// provided Scene.
79 ///
80 virtual void Render(int64_t view_id,
81 Scene* scene,
82 double width,
83 double height) = 0;
84
85 //--------------------------------------------------------------------------
86 /// @brief Receives an updated semantics tree from the Framework.
87 ///
88 /// @param[in] update The updated semantic tree to apply.
89 ///
91
92 //--------------------------------------------------------------------------
93 /// @brief When the Flutter application has a message to send to the
94 /// underlying platform, the message needs to be forwarded to
95 /// the platform on the appropriate thread (via the platform
96 /// task runner). The PlatformConfiguration delegates this task
97 /// to the engine via this method.
98 ///
99 /// @see `PlatformView::HandlePlatformMessage`
100 ///
101 /// @param[in] message The message from the Flutter application to send to
102 /// the underlying platform.
103 ///
105 std::unique_ptr<PlatformMessage> message) = 0;
106
107 //--------------------------------------------------------------------------
108 /// @brief Returns the current collection of fonts available on the
109 /// platform.
110 ///
111 /// This function reads an XML file and makes font families and
112 /// collections of them. MinikinFontForTest is used for FontFamily
113 /// creation.
115
116 //--------------------------------------------------------------------------
117 /// @brief Returns the current collection of assets available on the
118 /// platform.
119 virtual std::shared_ptr<AssetManager> GetAssetManager() = 0;
120
121 //--------------------------------------------------------------------------
122 /// @brief Notifies this client of the name of the root isolate and its
123 /// port when that isolate is launched, restarted (in the
124 /// cold-restart scenario) or the application itself updates the
125 /// name of the root isolate (via `Window.setIsolateDebugName`
126 /// in `window.dart`). The name of the isolate is meaningless to
127 /// the engine but is used in instrumentation and tooling.
128 /// Currently, this information is to update the service
129 /// protocol list of available root isolates running in the VM
130 /// and their names so that the appropriate isolate can be
131 /// selected in the tools for debugging and instrumentation.
132 ///
133 /// @param[in] isolate_name The isolate name
134 /// @param[in] isolate_port The isolate port
135 ///
136 virtual void UpdateIsolateDescription(const std::string isolate_name,
137 int64_t isolate_port) = 0;
138
139 //--------------------------------------------------------------------------
140 /// @brief Notifies this client that the application has an opinion about
141 /// whether its frame timings need to be reported backed to it.
142 /// Due to the asynchronous nature of rendering in Flutter, it is
143 /// not possible for the application to determine the total time
144 /// it took to render a specific frame. While the layer-tree is
145 /// constructed on the UI thread, it needs to be rendering on the
146 /// raster thread. Dart code cannot execute on this thread. So any
147 /// instrumentation about the frame times gathered on this thread
148 /// needs to be aggregated and sent back to the UI thread for
149 /// processing in Dart.
150 ///
151 /// When the application indicates that frame times need to be
152 /// reported, it collects this information till a specified number
153 /// of data points are gathered. Then this information is sent
154 /// back to Dart code via `Engine::ReportTimings`.
155 ///
156 /// This option is engine counterpart of the
157 /// `Window._setNeedsReportTimings` in `window.dart`.
158 ///
159 /// @param[in] needs_reporting If reporting information should be collected
160 /// and send back to Dart.
161 ///
162 virtual void SetNeedsReportTimings(bool value) = 0;
163
164 //--------------------------------------------------------------------------
165 /// @brief The embedder can specify data that the isolate can request
166 /// synchronously on launch. This accessor fetches that data.
167 ///
168 /// This data is persistent for the duration of the Flutter
169 /// application and is available even after isolate restarts.
170 /// Because of this lifecycle, the size of this data must be kept
171 /// to a minimum.
172 ///
173 /// For asynchronous communication between the embedder and
174 /// isolate, a platform channel may be used.
175 ///
176 /// @return A map of the isolate data that the framework can request upon
177 /// launch.
178 ///
179 virtual std::shared_ptr<const fml::Mapping> GetPersistentIsolateData() = 0;
180
181 //--------------------------------------------------------------------------
182 /// @brief Directly invokes platform-specific APIs to compute the
183 /// locale the platform would have natively resolved to.
184 ///
185 /// @param[in] supported_locale_data The vector of strings that represents
186 /// the locales supported by the app.
187 /// Each locale consists of three
188 /// strings: languageCode, countryCode,
189 /// and scriptCode in that order.
190 ///
191 /// @return A vector of 3 strings languageCode, countryCode, and
192 /// scriptCode that represents the locale selected by the
193 /// platform. Empty strings mean the value was unassigned. Empty
194 /// vector represents a null locale.
195 ///
196 virtual std::unique_ptr<std::vector<std::string>>
198 const std::vector<std::string>& supported_locale_data) = 0;
199
200 //--------------------------------------------------------------------------
201 /// @brief Invoked when the Dart VM requests that a deferred library
202 /// be loaded. Notifies the engine that the deferred library
203 /// identified by the specified loading unit id should be
204 /// downloaded and loaded into the Dart VM via
205 /// `LoadDartDeferredLibrary`
206 ///
207 /// Upon encountering errors or otherwise failing to load a
208 /// loading unit with the specified id, the failure should be
209 /// directly reported to dart by calling
210 /// `LoadDartDeferredLibraryFailure` to ensure the waiting dart
211 /// future completes with an error.
212 ///
213 /// @param[in] loading_unit_id The unique id of the deferred library's
214 /// loading unit. This id is to be passed
215 /// back into LoadDartDeferredLibrary
216 /// in order to identify which deferred
217 /// library to load.
218 ///
219 virtual void RequestDartDeferredLibrary(intptr_t loading_unit_id) = 0;
220
221 //--------------------------------------------------------------------------
222 /// @brief Invoked when a listener is registered on a platform channel.
223 ///
224 /// @param[in] name The name of the platform channel to which a
225 /// listener has been registered or cleared.
226 ///
227 /// @param[in] listening Whether the listener has been set (true) or
228 /// cleared (false).
229 ///
230 virtual void SendChannelUpdate(std::string name, bool listening) = 0;
231
232 //--------------------------------------------------------------------------
233 /// @brief Synchronously invokes platform-specific APIs to apply the
234 /// system text scaling on the given unscaled font size.
235 ///
236 /// Platforms that support this feature (currently it's only
237 /// implemented for Android SDK level 34+) will send a valid
238 /// configuration_id to potential callers, before this method can
239 /// be called.
240 ///
241 /// @param[in] unscaled_font_size The unscaled font size specified by the
242 /// app developer. The value is in logical
243 /// pixels, and is guaranteed to be finite and
244 /// non-negative.
245 /// @param[in] configuration_id The unique id of the configuration to use
246 /// for computing the scaled font size.
247 ///
248 /// @return The scaled font size in logical pixels, or -1 if the given
249 /// configuration_id did not match a valid configuration.
250 ///
251 virtual double GetScaledFontSize(double unscaled_font_size,
252 int configuration_id) const = 0;
253
254 virtual std::shared_ptr<PlatformIsolateManager>
256
257 protected:
259};
260
261//----------------------------------------------------------------------------
262/// @brief A class for holding and distributing platform-level information
263/// to and from the Dart code in Flutter's framework.
264///
265/// It handles communication between the engine and the framework.
266///
267/// It communicates with the RuntimeController through the use of a
268/// PlatformConfigurationClient interface, which the
269/// RuntimeController defines.
270///
272 public:
273 //----------------------------------------------------------------------------
274 /// @brief Creates a new PlatformConfiguration, typically created by the
275 /// RuntimeController.
276 ///
277 /// @param[in] client The `PlatformConfigurationClient` to be injected into
278 /// the PlatformConfiguration. This client is used to
279 /// forward requests to the RuntimeController.
280 ///
282
283 // PlatformConfiguration is not copyable.
286
288
289 //----------------------------------------------------------------------------
290 /// @brief Access to the platform configuration client (which typically
291 /// is implemented by the RuntimeController).
292 ///
293 /// @return Returns the client used to construct this
294 /// PlatformConfiguration.
295 ///
296 PlatformConfigurationClient* client() const { return client_; }
297
298 //----------------------------------------------------------------------------
299 /// @brief Called by the RuntimeController once it has created the root
300 /// isolate, so that the PlatformController can get a handle to
301 /// the 'dart:ui' library.
302 ///
303 /// It uses the handle to call the hooks in hooks.dart.
304 ///
305 void DidCreateIsolate();
306
307 //----------------------------------------------------------------------------
308 /// @brief Notify the framework that a new view is available.
309 ///
310 /// A view must be added before other methods can refer to it,
311 /// including the implicit view. Adding a view that already exists
312 /// triggers an assertion.
313 ///
314 /// @param[in] view_id The ID of the new view.
315 /// @param[in] viewport_metrics The initial viewport metrics for the view.
316 ///
317 /// @return Whether the view was added.
318 ///
319 bool AddView(int64_t view_id, const ViewportMetrics& view_metrics);
320
321 //----------------------------------------------------------------------------
322 /// @brief Notify the framework that a view is no longer available.
323 ///
324 /// Removing a view that does not exist triggers an assertion.
325 ///
326 /// The implicit view (kFlutterImplicitViewId) should never be
327 /// removed. Doing so triggers an assertion.
328 ///
329 /// @param[in] view_id The ID of the view.
330 ///
331 /// @return Whether the view was removed.
332 ///
333 bool RemoveView(int64_t view_id);
334
335 //----------------------------------------------------------------------------
336 /// @brief Update the view metrics for the specified view.
337 ///
338 /// If the view is not found, silently return false.
339 ///
340 /// @param[in] view_id The ID of the view.
341 /// @param[in] metrics The new metrics of the view.
342 ///
343 /// @return Whether the view is found.
344 ///
345 bool UpdateViewMetrics(int64_t view_id, const ViewportMetrics& metrics);
346
347 //----------------------------------------------------------------------------
348 /// @brief Update the specified display data in the framework.
349 ///
350 /// @param[in] displays The display data to send to Dart.
351 ///
352 void UpdateDisplays(const std::vector<DisplayData>& displays);
353
354 //----------------------------------------------------------------------------
355 /// @brief Update the specified locale data in the framework.
356 ///
357 /// @param[in] locale_data The locale data. This should consist of groups of
358 /// 4 strings, each group representing a single locale.
359 ///
360 void UpdateLocales(const std::vector<std::string>& locales);
361
362 //----------------------------------------------------------------------------
363 /// @brief Update the user settings data in the framework.
364 ///
365 /// @param[in] data The user settings data.
366 ///
367 void UpdateUserSettingsData(const std::string& data);
368
369 //----------------------------------------------------------------------------
370 /// @brief Updates the lifecycle state data in the framework.
371 ///
372 /// @param[in] data The lifecycle state data.
373 ///
374 void UpdateInitialLifecycleState(const std::string& data);
375
376 //----------------------------------------------------------------------------
377 /// @brief Notifies the PlatformConfiguration that the embedder has
378 /// expressed an opinion about whether the accessibility tree
379 /// should be generated or not. This call originates in the
380 /// platform view and is forwarded to the PlatformConfiguration
381 /// here by the engine.
382 ///
383 /// @param[in] enabled Whether the accessibility tree is enabled or
384 /// disabled.
385 ///
386 void UpdateSemanticsEnabled(bool enabled);
387
388 //----------------------------------------------------------------------------
389 /// @brief Forward the preference of accessibility features that must be
390 /// enabled in the semantics tree to the framwork.
391 ///
392 /// @param[in] flags The accessibility features that must be generated in
393 /// the semantics tree.
394 ///
396
397 //----------------------------------------------------------------------------
398 /// @brief Notifies the PlatformConfiguration that the client has sent
399 /// it a message. This call originates in the platform view and
400 /// has been forwarded through the engine to here.
401 ///
402 /// @param[in] message The message sent from the embedder to the Dart
403 /// application.
404 ///
405 void DispatchPlatformMessage(std::unique_ptr<PlatformMessage> message);
406
407 //----------------------------------------------------------------------------
408 /// @brief Notifies the PlatformConfiguration that the client has sent
409 /// it pointer events. This call originates in the platform view
410 /// and has been forwarded through the engine to here.
411 ///
412 /// @param[in] packet The pointer event(s) serialized into a packet.
413 ///
415
416 //----------------------------------------------------------------------------
417 /// @brief Notifies the framework that the embedder encountered an
418 /// accessibility related action on the specified node. This call
419 /// originates on the platform view and has been forwarded to the
420 /// platform configuration here by the engine.
421 ///
422 /// @param[in] node_id The identifier of the accessibility node.
423 /// @param[in] action The accessibility related action performed on the
424 /// node of the specified ID.
425 /// @param[in] args Optional data that applies to the specified action.
426 ///
427 void DispatchSemanticsAction(int32_t node_id,
430
431 //----------------------------------------------------------------------------
432 /// @brief Notifies the framework that it is time to begin working on a
433 /// new frame previously scheduled via a call to
434 /// `PlatformConfigurationClient::ScheduleFrame`. This call
435 /// originates in the animator.
436 ///
437 /// The frame time given as the argument indicates the point at
438 /// which the current frame interval began. It is very slightly
439 /// (because of scheduling overhead) in the past. If a new layer
440 /// tree is not produced and given to the raster task runner
441 /// within one frame interval from this point, the Flutter
442 /// application will jank.
443 ///
444 /// This method calls the `::_beginFrame` method in `hooks.dart`.
445 ///
446 /// @param[in] frame_time The point at which the current frame interval
447 /// began. May be used by animation interpolators,
448 /// physics simulations, etc..
449 ///
450 /// @param[in] frame_number The frame number recorded by the animator. Used
451 /// by the framework to associate frame specific
452 /// debug information with frame timings and timeline
453 /// events.
454 ///
455 void BeginFrame(fml::TimePoint frame_time, uint64_t frame_number);
456
457 //----------------------------------------------------------------------------
458 /// @brief Dart code cannot fully measure the time it takes for a
459 /// specific frame to be rendered. This is because Dart code only
460 /// runs on the UI task runner. That is only a small part of the
461 /// overall frame workload. The raster task runner frame workload
462 /// is executed on a thread where Dart code cannot run (and hence
463 /// instrument). Besides, due to the pipelined nature of rendering
464 /// in Flutter, there may be multiple frame workloads being
465 /// processed at any given time. However, for non-Timeline based
466 /// profiling, it is useful for trace collection and processing to
467 /// happen in Dart. To do this, the raster task runner frame
468 /// workloads need to be instrumented separately. After a set
469 /// number of these profiles have been gathered, they need to be
470 /// reported back to Dart code. The engine reports this extra
471 /// instrumentation information back to the framework by invoking
472 /// this method at predefined intervals.
473 ///
474 /// @see `FrameTiming`
475 ///
476 /// @param[in] timings Collection of `FrameTiming::kStatisticsCount` * 'n'
477 /// values for `n` frames whose timings have not been
478 /// reported yet. Many of the values are timestamps, but
479 /// a collection of integers is reported here for easier
480 /// conversions to Dart objects. The timestamps are
481 /// measured against the system monotonic clock measured
482 /// in microseconds.
483 ///
484 void ReportTimings(std::vector<int64_t> timings);
485
486 //----------------------------------------------------------------------------
487 /// @brief Retrieves the viewport metrics with the given ID managed by
488 /// the `PlatformConfiguration`.
489 ///
490 /// @param[in] view_id The id of the view's viewport metrics to return.
491 ///
492 /// @return a pointer to the ViewportMetrics. Returns nullptr if the ID is
493 /// not found.
494 ///
495 const ViewportMetrics* GetMetrics(int view_id);
496
497 //----------------------------------------------------------------------------
498 /// @brief Responds to a previous platform message to the engine from the
499 /// framework.
500 ///
501 /// @param[in] response_id The unique id that identifies the original platform
502 /// message to respond to.
503 /// @param[in] data The data to send back in the response.
504 ///
505 void CompletePlatformMessageResponse(int response_id,
506 std::vector<uint8_t> data);
507
508 //----------------------------------------------------------------------------
509 /// @brief Responds to a previous platform message to the engine from the
510 /// framework with an empty response.
511 ///
512 /// @param[in] response_id The unique id that identifies the original platform
513 /// message to respond to.
514 ///
515 void CompletePlatformMessageEmptyResponse(int response_id);
516
517 Dart_Handle on_error() { return on_error_.Get(); }
518
519 private:
523 tonic::DartPersistentValue remove_view_;
524 tonic::DartPersistentValue update_window_metrics_;
525 tonic::DartPersistentValue update_displays_;
526 tonic::DartPersistentValue update_locales_;
527 tonic::DartPersistentValue update_user_settings_data_;
528 tonic::DartPersistentValue update_initial_lifecycle_state_;
529 tonic::DartPersistentValue update_semantics_enabled_;
530 tonic::DartPersistentValue update_accessibility_features_;
531 tonic::DartPersistentValue dispatch_platform_message_;
532 tonic::DartPersistentValue dispatch_pointer_data_packet_;
533 tonic::DartPersistentValue dispatch_semantics_action_;
534 tonic::DartPersistentValue begin_frame_;
535 tonic::DartPersistentValue draw_frame_;
536 tonic::DartPersistentValue report_timings_;
537
538 // All current views' view metrics mapped from view IDs.
539 std::unordered_map<int64_t, ViewportMetrics> metrics_;
540
541 // ID starts at 1 because an ID of 0 indicates that no response is expected.
542 int next_response_id_ = 1;
543 std::unordered_map<int, fml::RefPtr<PlatformMessageResponse>>
544 pending_responses_;
545};
546
547//----------------------------------------------------------------------------
548/// An inteface that the result of `Dart_CurrentIsolateGroupData` should
549/// implement for registering background isolates to work.
551 public:
554 int64_t root_isolate_token,
555 std::weak_ptr<PlatformMessageHandler> handler) = 0;
556
557 virtual std::weak_ptr<PlatformMessageHandler> GetPlatformMessageHandler(
558 int64_t root_isolate_token) const = 0;
559};
560
561//----------------------------------------------------------------------------
562// API exposed as FFI calls in Dart.
563//
564// These are probably not supposed to be called directly, and should instead
565// be called through their sibling API in `PlatformConfiguration` or
566// `PlatformConfigurationClient`.
567//
568// These are intentionally undocumented. Refer instead to the sibling methods
569// above.
570//----------------------------------------------------------------------------
572 public:
573 static std::string DefaultRouteName();
574
575 static void ScheduleFrame();
576
577 static void EndWarmUpFrame();
578
579 static void Render(int64_t view_id,
580 Scene* scene,
581 double width,
582 double height);
583
585
586 static void SetNeedsReportTimings(bool value);
587
589
591 Dart_Handle supportedLocalesHandle);
592
593 static void SetIsolateDebugName(const std::string& name);
594
595 static Dart_Handle SendPlatformMessage(const std::string& name,
597 Dart_Handle data_handle);
598
599 static Dart_Handle SendPortPlatformMessage(const std::string& name,
601 Dart_Handle send_port,
602 Dart_Handle data_handle);
603
604 static void RespondToPlatformMessage(int response_id,
606
607 static void SendChannelUpdate(const std::string& name, bool listening);
608
609 //--------------------------------------------------------------------------
610 /// @brief Requests the Dart VM to adjusts the GC heuristics based on
611 /// the requested `performance_mode`. Returns the old performance
612 /// mode.
613 ///
614 /// Requesting a performance mode doesn't guarantee any
615 /// performance characteristics. This is best effort, and should
616 /// be used after careful consideration of the various GC
617 /// trade-offs.
618 ///
619 /// @param[in] performance_mode The requested performance mode. Please refer
620 /// to documentation of `Dart_PerformanceMode`
621 /// for more details about what each performance
622 /// mode does.
623 ///
624 static int RequestDartPerformanceMode(int mode);
625
626 //--------------------------------------------------------------------------
627 /// @brief Returns the current performance mode of the Dart VM. Defaults
628 /// to `Dart_PerformanceMode_Default` if no prior requests to change the
629 /// performance mode have been made.
631
632 static int64_t GetRootIsolateToken();
633
634 static void RegisterBackgroundIsolate(int64_t root_isolate_token);
635
636 static double GetScaledFontSize(double unscaled_font_size,
637 int configuration_id);
638
639 private:
640 static Dart_PerformanceMode current_performance_mode_;
641};
642
643} // namespace flutter
644
645#endif // FLUTTER_LIB_UI_WINDOW_PLATFORM_CONFIGURATION_H_
A client interface that the RuntimeController uses to define handlers for PlatformConfiguration reque...
virtual FontCollection & GetFontCollection()=0
Returns the current collection of fonts available on the platform.
virtual std::shared_ptr< const fml::Mapping > GetPersistentIsolateData()=0
The embedder can specify data that the isolate can request synchronously on launch....
virtual std::shared_ptr< PlatformIsolateManager > GetPlatformIsolateManager()=0
virtual void EndWarmUpFrame()=0
Called when a warm up frame has ended.
virtual void SetNeedsReportTimings(bool value)=0
Notifies this client that the application has an opinion about whether its frame timings need to be r...
virtual std::string DefaultRouteName()=0
The route or path that the embedder requested when the application was launched.
virtual void ScheduleFrame()=0
Requests that, at the next appropriate opportunity, a new frame be scheduled for rendering.
virtual std::shared_ptr< AssetManager > GetAssetManager()=0
Returns the current collection of assets available on the platform.
virtual void UpdateIsolateDescription(const std::string isolate_name, int64_t isolate_port)=0
Notifies this client of the name of the root isolate and its port when that isolate is launched,...
virtual double GetScaledFontSize(double unscaled_font_size, int configuration_id) const =0
Synchronously invokes platform-specific APIs to apply the system text scaling on the given unscaled f...
virtual std::unique_ptr< std::vector< std::string > > ComputePlatformResolvedLocale(const std::vector< std::string > &supported_locale_data)=0
Directly invokes platform-specific APIs to compute the locale the platform would have natively resolv...
virtual void HandlePlatformMessage(std::unique_ptr< PlatformMessage > message)=0
When the Flutter application has a message to send to the underlying platform, the message needs to b...
virtual void RequestDartDeferredLibrary(intptr_t loading_unit_id)=0
Invoked when the Dart VM requests that a deferred library be loaded. Notifies the engine that the def...
virtual void UpdateSemantics(SemanticsUpdate *update)=0
Receives an updated semantics tree from the Framework.
virtual void Render(int64_t view_id, Scene *scene, double width, double height)=0
Updates the client's rendering on the GPU with the newly provided Scene.
virtual void SendChannelUpdate(std::string name, bool listening)=0
Invoked when a listener is registered on a platform channel.
static void SendChannelUpdate(const std::string &name, bool listening)
static void Render(int64_t view_id, Scene *scene, double width, double height)
static Dart_Handle SendPortPlatformMessage(const std::string &name, Dart_Handle identifier, Dart_Handle send_port, Dart_Handle data_handle)
static double GetScaledFontSize(double unscaled_font_size, int configuration_id)
static int RequestDartPerformanceMode(int mode)
Requests the Dart VM to adjusts the GC heuristics based on the requested performance_mode....
static void UpdateSemantics(SemanticsUpdate *update)
static Dart_PerformanceMode GetDartPerformanceMode()
Returns the current performance mode of the Dart VM. Defaults to Dart_PerformanceMode_Default if no p...
static Dart_Handle ComputePlatformResolvedLocale(Dart_Handle supportedLocalesHandle)
static void RegisterBackgroundIsolate(int64_t root_isolate_token)
static Dart_Handle SendPlatformMessage(const std::string &name, Dart_Handle callback, Dart_Handle data_handle)
static void RespondToPlatformMessage(int response_id, const tonic::DartByteData &data)
static void SetIsolateDebugName(const std::string &name)
A class for holding and distributing platform-level information to and from the Dart code in Flutter'...
void UpdateAccessibilityFeatures(int32_t flags)
Forward the preference of accessibility features that must be enabled in the semantics tree to the fr...
void DidCreateIsolate()
Called by the RuntimeController once it has created the root isolate, so that the PlatformController ...
void DispatchPointerDataPacket(const PointerDataPacket &packet)
Notifies the PlatformConfiguration that the client has sent it pointer events. This call originates i...
void CompletePlatformMessageResponse(int response_id, std::vector< uint8_t > data)
Responds to a previous platform message to the engine from the framework.
PlatformConfiguration & operator=(const PlatformConfiguration &)=delete
void DispatchPlatformMessage(std::unique_ptr< PlatformMessage > message)
Notifies the PlatformConfiguration that the client has sent it a message. This call originates in the...
void UpdateSemanticsEnabled(bool enabled)
Notifies the PlatformConfiguration that the embedder has expressed an opinion about whether the acces...
void ReportTimings(std::vector< int64_t > timings)
Dart code cannot fully measure the time it takes for a specific frame to be rendered....
bool AddView(int64_t view_id, const ViewportMetrics &view_metrics)
Notify the framework that a new view is available.
void UpdateInitialLifecycleState(const std::string &data)
Updates the lifecycle state data in the framework.
void DispatchSemanticsAction(int32_t node_id, SemanticsAction action, fml::MallocMapping args)
Notifies the framework that the embedder encountered an accessibility related action on the specified...
void UpdateDisplays(const std::vector< DisplayData > &displays)
Update the specified display data in the framework.
void UpdateLocales(const std::vector< std::string > &locales)
Update the specified locale data in the framework.
PlatformConfiguration(const PlatformConfiguration &)=delete
bool RemoveView(int64_t view_id)
Notify the framework that a view is no longer available.
void BeginFrame(fml::TimePoint frame_time, uint64_t frame_number)
Notifies the framework that it is time to begin working on a new frame previously scheduled via a cal...
void CompletePlatformMessageEmptyResponse(int response_id)
Responds to a previous platform message to the engine from the framework with an empty response.
const ViewportMetrics * GetMetrics(int view_id)
Retrieves the viewport metrics with the given ID managed by the PlatformConfiguration.
bool UpdateViewMetrics(int64_t view_id, const ViewportMetrics &metrics)
Update the view metrics for the specified view.
PlatformConfigurationClient * client() const
Access to the platform configuration client (which typically is implemented by the RuntimeController)...
void UpdateUserSettingsData(const std::string &data)
Update the user settings data in the framework.
virtual void SetPlatformMessageHandler(int64_t root_isolate_token, std::weak_ptr< PlatformMessageHandler > handler)=0
virtual std::weak_ptr< PlatformMessageHandler > GetPlatformMessageHandler(int64_t root_isolate_token) const =0
virtual ~PlatformMessageHandlerStorage()=default
A Mapping like NonOwnedMapping, but uses Free as its release proc.
Definition mapping.h:144
static SkString identifier(const FontFamilyDesc &family, const FontDesc &font)
Dart_PerformanceMode
Definition dart_api.h:1368
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258
FlutterSemanticsFlag flags
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
uint8_t value
Win32Message message
DEF_SWITCHES_START aot vmservice shared library name
Definition switches.h:32
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition switches.h:228
AccessibilityFeatureFlag
An enum for defining the different kinds of accessibility features that can be enabled by the platfor...
int32_t height
int32_t width