Flutter Engine
The Flutter Engine
|
A class for holding and distributing platform-level information to and from the Dart code in Flutter's framework. More...
#include <platform_configuration.h>
Public Member Functions | |
PlatformConfiguration (PlatformConfigurationClient *client) | |
Creates a new PlatformConfiguration, typically created by the RuntimeController. More... | |
PlatformConfiguration (const PlatformConfiguration &)=delete | |
PlatformConfiguration & | operator= (const PlatformConfiguration &)=delete |
~PlatformConfiguration () | |
PlatformConfigurationClient * | client () const |
Access to the platform configuration client (which typically is implemented by the RuntimeController). More... | |
void | DidCreateIsolate () |
Called by the RuntimeController once it has created the root isolate, so that the PlatformController can get a handle to the 'dart:ui' library. More... | |
bool | AddView (int64_t view_id, const ViewportMetrics &view_metrics) |
Notify the framework that a new view is available. More... | |
bool | RemoveView (int64_t view_id) |
Notify the framework that a view is no longer available. More... | |
bool | UpdateViewMetrics (int64_t view_id, const ViewportMetrics &metrics) |
Update the view metrics for the specified view. More... | |
void | UpdateDisplays (const std::vector< DisplayData > &displays) |
Update the specified display data in the framework. More... | |
void | UpdateLocales (const std::vector< std::string > &locales) |
Update the specified locale data in the framework. More... | |
void | UpdateUserSettingsData (const std::string &data) |
Update the user settings data in the framework. More... | |
void | UpdateInitialLifecycleState (const std::string &data) |
Updates the lifecycle state data in the framework. More... | |
void | UpdateSemanticsEnabled (bool enabled) |
Notifies the PlatformConfiguration that the embedder has expressed an opinion about whether the accessibility tree should be generated or not. This call originates in the platform view and is forwarded to the PlatformConfiguration here by the engine. More... | |
void | UpdateAccessibilityFeatures (int32_t flags) |
Forward the preference of accessibility features that must be enabled in the semantics tree to the framwork. More... | |
void | DispatchPlatformMessage (std::unique_ptr< PlatformMessage > message) |
Notifies the PlatformConfiguration that the client has sent it a message. This call originates in the platform view and has been forwarded through the engine to here. More... | |
void | DispatchPointerDataPacket (const PointerDataPacket &packet) |
Notifies the PlatformConfiguration that the client has sent it pointer events. This call originates in the platform view and has been forwarded through the engine to here. More... | |
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 node. This call originates on the platform view and has been forwarded to the platform configuration here by the engine. More... | |
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 call to PlatformConfigurationClient::ScheduleFrame . This call originates in the animator. More... | |
void | ReportTimings (std::vector< int64_t > timings) |
Dart code cannot fully measure the time it takes for a specific frame to be rendered. This is because Dart code only runs on the UI task runner. That is only a small part of the overall frame workload. The raster task runner frame workload is executed on a thread where Dart code cannot run (and hence instrument). Besides, due to the pipelined nature of rendering in Flutter, there may be multiple frame workloads being processed at any given time. However, for non-Timeline based profiling, it is useful for trace collection and processing to happen in Dart. To do this, the raster task runner frame workloads need to be instrumented separately. After a set number of these profiles have been gathered, they need to be reported back to Dart code. The engine reports this extra instrumentation information back to the framework by invoking this method at predefined intervals. More... | |
const ViewportMetrics * | GetMetrics (int view_id) |
Retrieves the viewport metrics with the given ID managed by the PlatformConfiguration . More... | |
void | CompletePlatformMessageResponse (int response_id, std::vector< uint8_t > data) |
Responds to a previous platform message to the engine from the framework. More... | |
void | CompletePlatformMessageEmptyResponse (int response_id) |
Responds to a previous platform message to the engine from the framework with an empty response. More... | |
Dart_Handle | on_error () |
A class for holding and distributing platform-level information to and from the Dart code in Flutter's framework.
It handles communication between the engine and the framework.
It communicates with the RuntimeController through the use of a PlatformConfigurationClient interface, which the RuntimeController defines.
Definition at line 271 of file platform_configuration.h.
|
explicit |
Creates a new PlatformConfiguration, typically created by the RuntimeController.
[in] | client | The PlatformConfigurationClient to be injected into the PlatformConfiguration. This client is used to forward requests to the RuntimeController. |
Definition at line 34 of file platform_configuration.cc.
|
delete |
flutter::PlatformConfiguration::~PlatformConfiguration | ( | ) |
Definition at line 38 of file platform_configuration.cc.
bool flutter::PlatformConfiguration::AddView | ( | int64_t | view_id, |
const ViewportMetrics & | view_metrics | ||
) |
Notify the framework that a new view is available.
A view must be added before other methods can refer to it, including the implicit view. Adding a view that already exists triggers an assertion.
[in] | view_id | The ID of the new view. |
[in] | viewport_metrics | The initial viewport metrics for the view. |
Definition at line 86 of file platform_configuration.cc.
void flutter::PlatformConfiguration::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 call to PlatformConfigurationClient::ScheduleFrame
. This call originates in the animator.
The frame time given as the argument indicates the point at which the current frame interval began. It is very slightly (because of scheduling overhead) in the past. If a new layer tree is not produced and given to the raster task runner within one frame interval from this point, the Flutter application will jank.
This method calls the ::_beginFrame
method in hooks.dart
.
[in] | frame_time | The point at which the current frame interval began. May be used by animation interpolators, physics simulations, etc.. |
[in] | frame_number | The frame number recorded by the animator. Used by the framework to associate frame specific debug information with frame timings and timeline events. |
Definition at line 371 of file platform_configuration.cc.
|
inline |
Access to the platform configuration client (which typically is implemented by the RuntimeController).
Definition at line 296 of file platform_configuration.h.
void flutter::PlatformConfiguration::CompletePlatformMessageEmptyResponse | ( | int | response_id | ) |
Responds to a previous platform message to the engine from the framework with an empty response.
[in] | response_id | The unique id that identifies the original platform message to respond to. |
Definition at line 429 of file platform_configuration.cc.
void flutter::PlatformConfiguration::CompletePlatformMessageResponse | ( | int | response_id, |
std::vector< uint8_t > | data | ||
) |
Responds to a previous platform message to the engine from the framework.
[in] | response_id | The unique id that identifies the original platform message to respond to. |
[in] | data | The data to send back in the response. |
Definition at line 443 of file platform_configuration.cc.
void flutter::PlatformConfiguration::DidCreateIsolate | ( | ) |
Called by the RuntimeController once it has created the root isolate, so that the PlatformController can get a handle to the 'dart:ui' library.
It uses the handle to call the hooks in hooks.dart.
Definition at line 40 of file platform_configuration.cc.
void flutter::PlatformConfiguration::DispatchPlatformMessage | ( | std::unique_ptr< PlatformMessage > | message | ) |
Notifies the PlatformConfiguration that the client has sent it a message. This call originates in the platform view and has been forwarded through the engine to here.
[in] | message | The message sent from the embedder to the Dart application. |
Definition at line 296 of file platform_configuration.cc.
void flutter::PlatformConfiguration::DispatchPointerDataPacket | ( | const PointerDataPacket & | packet | ) |
Notifies the PlatformConfiguration that the client has sent it pointer events. This call originates in the platform view and has been forwarded through the engine to here.
[in] | packet | The pointer event(s) serialized into a packet. |
Definition at line 328 of file platform_configuration.cc.
void flutter::PlatformConfiguration::DispatchSemanticsAction | ( | int32_t | node_id, |
SemanticsAction | action, | ||
fml::MallocMapping | args | ||
) |
Notifies the framework that the embedder encountered an accessibility related action on the specified node. This call originates on the platform view and has been forwarded to the platform configuration here by the engine.
[in] | node_id | The identifier of the accessibility node. |
[in] | action | The accessibility related action performed on the node of the specified ID. |
[in] | args | Optional data that applies to the specified action. |
Definition at line 348 of file platform_configuration.cc.
const ViewportMetrics * flutter::PlatformConfiguration::GetMetrics | ( | int | view_id | ) |
Retrieves the viewport metrics with the given ID managed by the PlatformConfiguration
.
[in] | view_id | The id of the view's viewport metrics to return. |
Definition at line 420 of file platform_configuration.cc.
|
inline |
Definition at line 517 of file platform_configuration.h.
|
delete |
bool flutter::PlatformConfiguration::RemoveView | ( | int64_t | view_id | ) |
Notify the framework that a view is no longer available.
Removing a view that does not exist triggers an assertion. The implicit view (kFlutterImplicitViewId) should never be removed. Doing so triggers an assertion.
[in] | view_id | The ID of the view. |
Definition at line 128 of file platform_configuration.cc.
void flutter::PlatformConfiguration::ReportTimings | ( | std::vector< int64_t > | timings | ) |
Dart code cannot fully measure the time it takes for a specific frame to be rendered. This is because Dart code only runs on the UI task runner. That is only a small part of the overall frame workload. The raster task runner frame workload is executed on a thread where Dart code cannot run (and hence instrument). Besides, due to the pipelined nature of rendering in Flutter, there may be multiple frame workloads being processed at any given time. However, for non-Timeline based profiling, it is useful for trace collection and processing to happen in Dart. To do this, the raster task runner frame workloads need to be instrumented separately. After a set number of these profiles have been gathered, they need to be reported back to Dart code. The engine reports this extra instrumentation information back to the framework by invoking this method at predefined intervals.
FrameTiming
[in] | timings | Collection of FrameTiming::kStatisticsCount * 'n' values for n frames whose timings have not been reported yet. Many of the values are timestamps, but a collection of integers is reported here for easier conversions to Dart objects. The timestamps are measured against the system monotonic clock measured in microseconds. |
Definition at line 393 of file platform_configuration.cc.
void flutter::PlatformConfiguration::UpdateAccessibilityFeatures | ( | int32_t | flags | ) |
Forward the preference of accessibility features that must be enabled in the semantics tree to the framwork.
[in] | flags | The accessibility features that must be generated in the semantics tree. |
Definition at line 284 of file platform_configuration.cc.
void flutter::PlatformConfiguration::UpdateDisplays | ( | const std::vector< DisplayData > & | displays | ) |
Update the specified display data in the framework.
[in] | displays | The display data to send to Dart. |
Definition at line 196 of file platform_configuration.cc.
void flutter::PlatformConfiguration::UpdateInitialLifecycleState | ( | const std::string & | data | ) |
Updates the lifecycle state data in the framework.
[in] | data | The lifecycle state data. |
Definition at line 257 of file platform_configuration.cc.
void flutter::PlatformConfiguration::UpdateLocales | ( | const std::vector< std::string > & | locales | ) |
Update the specified locale data in the framework.
[in] | locale_data | The locale data. This should consist of groups of 4 strings, each group representing a single locale. |
Definition at line 227 of file platform_configuration.cc.
void flutter::PlatformConfiguration::UpdateSemanticsEnabled | ( | bool | enabled | ) |
Notifies the PlatformConfiguration that the embedder has expressed an opinion about whether the accessibility tree should be generated or not. This call originates in the platform view and is forwarded to the PlatformConfiguration here by the engine.
[in] | enabled | Whether the accessibility tree is enabled or disabled. |
Definition at line 271 of file platform_configuration.cc.
void flutter::PlatformConfiguration::UpdateUserSettingsData | ( | const std::string & | data | ) |
Update the user settings data in the framework.
[in] | data | The user settings data. |
Definition at line 243 of file platform_configuration.cc.
bool flutter::PlatformConfiguration::UpdateViewMetrics | ( | int64_t | view_id, |
const ViewportMetrics & | metrics | ||
) |
Update the view metrics for the specified view.
If the view is not found, silently return false.
[in] | view_id | The ID of the view. |
[in] | metrics | The new metrics of the view. |
Definition at line 152 of file platform_configuration.cc.