#include <runtime_controller.h>
Public Types | |
| using | AddViewCallback = std::function< void(bool added)> |
Public Member Functions | |
| RuntimeController (RuntimeDelegate &p_client, DartVM *vm, fml::RefPtr< const DartSnapshot > p_isolate_snapshot, const std::function< void(int64_t)> &idle_notification_callback, const PlatformData &platform_data, const fml::closure &isolate_create_callback, const fml::closure &isolate_shutdown_callback, std::shared_ptr< const fml::Mapping > p_persistent_isolate_data, const UIDartState::Context &context) | |
| Creates a new instance of a runtime controller. This is usually only done by the engine instance associated with the shell. | |
| std::unique_ptr< RuntimeController > | Spawn (RuntimeDelegate &p_client, const std::string &advisory_script_uri, const std::string &advisory_script_entrypoint, const std::function< void(int64_t)> &idle_notification_callback, const fml::closure &isolate_create_callback, const fml::closure &isolate_shutdown_callback, const std::shared_ptr< const fml::Mapping > &persistent_isolate_data, fml::WeakPtr< IOManager > io_manager, fml::TaskRunnerAffineWeakPtr< ImageDecoder > image_decoder, fml::TaskRunnerAffineWeakPtr< ImageGeneratorRegistry > image_generator_registry, fml::TaskRunnerAffineWeakPtr< SnapshotDelegate > snapshot_delegate) const |
| Create a RuntimeController that shares as many resources as possible with the calling RuntimeController such that together they occupy less memory. | |
| ~RuntimeController () override | |
| bool | LaunchRootIsolate (const Settings &settings, const fml::closure &root_isolate_create_callback, std::optional< std::string > dart_entrypoint, std::optional< std::string > dart_entrypoint_library, const std::vector< std::string > &dart_entrypoint_args, std::unique_ptr< IsolateConfiguration > isolate_configuration, std::shared_ptr< NativeAssetsManager > native_assets_manager, std::optional< int64_t > engine_id) |
Launches the isolate using the window data associated with this runtime controller. Before this call, the Dart isolate has not been initialized. On successful return, the caller can assume that the isolate is in the DartIsolate::Phase::Running phase. | |
| std::unique_ptr< RuntimeController > | Clone () const |
| Clone the runtime controller. Launching an isolate with a cloned runtime controller will use the same snapshots and copies all window data to the new instance. This is usually only used in the debug runtime mode to support the cold-restart scenario. | |
| void | AddView (int64_t view_id, const ViewportMetrics &view_metrics, AddViewCallback callback) |
| Notify the isolate that a new view is available. | |
| bool | RemoveView (int64_t view_id) |
| Notify the isolate that a view is no longer available. | |
| bool | SendViewFocusEvent (const ViewFocusEvent &event) |
| Notify the isolate that the focus state of a native view has changed. | |
| bool | SetViewportMetrics (int64_t view_id, const ViewportMetrics &metrics) |
| Forward the specified viewport metrics to the running isolate. If the isolate is not running, these metrics will be saved and flushed to the isolate when it starts. | |
| bool | SetDisplays (const std::vector< DisplayData > &displays) |
| Forward the specified display metrics to the running isolate. If the isolate is not running, these metrics will be saved and flushed to the isolate when it starts. | |
| bool | SetLocales (const std::vector< std::string > &locale_data) |
| Forward the specified locale data to the running isolate. If the isolate is not running, this data will be saved and flushed to the isolate when it starts running. | |
| bool | SetUserSettingsData (const std::string &data) |
| Forward the user settings data to the running isolate. If the isolate is not running, this data will be saved and flushed to the isolate when it starts running. | |
| bool | SetInitialLifecycleState (const std::string &data) |
| Forward the initial lifecycle state data to the running isolate. If the isolate is not running, this data will be saved and flushed to the isolate when it starts running. After the isolate starts running, the current lifecycle state is pushed to it via the "flutter/lifecycle" channel. | |
| bool | SetSemanticsEnabled (bool enabled) |
| Notifies the running isolate about whether the semantics tree should be generated or not. If the isolate is not running, this preference will be saved and flushed to the isolate when it starts running. | |
| bool | SetAccessibilityFeatures (int32_t flags) |
| Forward the preference of accessibility features that must be enabled in the semantics tree to the running isolate. If the isolate is not running, this data will be saved and flushed to the isolate when it starts running. | |
| bool | BeginFrame (fml::TimePoint frame_time, uint64_t frame_number) |
| Notifies the running isolate that it should start generating a new frame. | |
| bool | 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 Dart code running on the engine by invoking this method at predefined intervals. | |
| virtual bool | NotifyIdle (fml::TimeDelta deadline) |
| Notify the Dart VM that no frame workloads are expected on the UI task runner till the specified deadline. The VM uses this opportunity to perform garbage collection operations is a manner that interferes as little as possible with frame rendering. | |
| virtual bool | IsRootIsolateRunning () const |
| Returns if the root isolate is running. The isolate must be transitioned to the running phase manually. The isolate can stop running if it terminates execution on its own. | |
| virtual bool | DispatchPlatformMessage (std::unique_ptr< PlatformMessage > message) |
| Dispatch the specified platform message to running root isolate. | |
| bool | DispatchPointerDataPacket (const PointerDataPacket &packet) |
| Dispatch the specified pointer data message to the running root isolate. | |
| bool | DispatchSemanticsAction (int64_t view_id, int32_t node_id, SemanticsAction action, fml::MallocMapping args) |
| Dispatch the semantics action to the specified accessibility node. | |
| Dart_Port | GetMainPort () |
| Gets the main port identifier of the root isolate. | |
| std::string | GetIsolateName () |
Gets the debug name of the root isolate. But default, the debug name of the isolate is derived from its advisory script URI, advisory main entrypoint and its main port name. For example, "main.dart$main-1234" where the script URI is "main.dart", the entrypoint is "main" and the port name "1234". Once launched, the isolate may re-christen itself using a name it selects via setIsolateDebugName in window.dart. This name is purely advisory and only used by instrumentation and reporting purposes. | |
| bool | HasLivePorts () |
| Returns if the root isolate has any live receive ports. | |
| bool | HasPendingMicrotasks () |
| Returns if the root isolate has any pending microtasks. | |
| tonic::DartErrorHandleType | GetLastError () |
| Get the last error encountered by the microtask queue. | |
| std::optional< std::string > | GetRootIsolateServiceID () const |
| Get the service ID of the root isolate if the root isolate is running. | |
| std::optional< uint32_t > | GetRootIsolateReturnCode () |
| Get the return code specified by the root isolate (if one is present). | |
| uint64_t | GetRootIsolateGroup () const |
| Get an identifier that represents the Dart isolate group the root isolate is in. | |
| void | LoadDartDeferredLibrary (intptr_t loading_unit_id, std::unique_ptr< const fml::Mapping > snapshot_data, std::unique_ptr< const fml::Mapping > snapshot_instructions) |
| Loads the Dart shared library into the Dart VM. When the Dart library is loaded successfully, the Dart future returned by the originating loadLibrary() call completes. | |
| virtual void | LoadDartDeferredLibraryError (intptr_t loading_unit_id, const std::string error_message, bool transient) |
| Indicates to the dart VM that the request to load a deferred library with the specified loading unit id has failed. | |
| void | RequestDartDeferredLibrary (intptr_t loading_unit_id) override |
Invoked when the Dart VM requests that a deferred library be loaded. Notifies the engine that the deferred library identified by the specified loading unit id should be downloaded and loaded into the Dart VM via LoadDartDeferredLibrary | |
| std::shared_ptr< const fml::Mapping > | GetPersistentIsolateData () override |
| The embedder can specify data that the isolate can request synchronously on launch. This accessor fetches that data. | |
| void | UpdateSemantics (int64_t view_id, SemanticsUpdate *update) override |
| Receives an updated semantics tree from the Framework. | |
| void | SetApplicationLocale (std::string locale) override |
| Framework sets the application locale. | |
| void | SetSemanticsTreeEnabled (bool enabled) override |
| Notifies whether Framework starts generating semantics tree. | |
| const fml::WeakPtr< IOManager > & | GetIOManager () const |
| virtual DartVM * | GetDartVM () const |
| const fml::RefPtr< const DartSnapshot > & | GetIsolateSnapshot () const |
| const PlatformData & | GetPlatformData () const |
| const fml::RefPtr< SkiaUnrefQueue > & | GetSkiaUnrefQueue () const |
| const fml::TaskRunnerAffineWeakPtr< SnapshotDelegate > & | GetSnapshotDelegate () const |
| std::weak_ptr< const DartIsolate > | GetRootIsolate () const |
| void | FlushMicrotaskQueue () |
| std::shared_ptr< PlatformIsolateManager > | GetPlatformIsolateManager () override |
| void | SetRootIsolateOwnerToCurrentThread () |
| void | ShutdownPlatformIsolates () |
| Shuts down all registered platform isolates. Must be called from the platform thread. | |
Protected Member Functions | |
| RuntimeController (RuntimeDelegate &p_client, const TaskRunners &task_runners) | |
| Constructor for Mocks. | |
Protected Member Functions inherited from flutter::PlatformConfigurationClient | |
| virtual | ~PlatformConfigurationClient () |
Represents an instance of a running root isolate with window bindings. In normal operation, a single instance of this object is owned by the engine per shell. This object may only be created, used, and collected on the UI task runner. Window state queried by the root isolate is stored by this object. In cold-restart scenarios, the engine may collect this before installing a new runtime controller in its place. The Clone method may be used by the engine to copy the currently accumulated window state so it can be referenced by the new runtime controller.
When RuntimeController is created, it takes some time before the root isolate becomes ready. Operation during this gap is stored by RuntimeController and flushed to the Dart VM when the isolate becomes ready before the entrypoint function. See PlatformData.
Definition at line 50 of file runtime_controller.h.
| using flutter::RuntimeController::AddViewCallback = std::function<void(bool added)> |
A callback that's invoked after this RuntimeController attempts to add a view to the Dart isolate.
If the Dart isolate is not launched yet, this callback will be stored and invoked after the isolate is launched.
The added parameter is false if the add operation fails or was cancelled while pending using RemoveView.
Definition at line 61 of file runtime_controller.h.
| flutter::RuntimeController::RuntimeController | ( | RuntimeDelegate & | p_client, |
| DartVM * | vm, | ||
| fml::RefPtr< const DartSnapshot > | p_isolate_snapshot, | ||
| const std::function< void(int64_t)> & | idle_notification_callback, | ||
| const PlatformData & | platform_data, | ||
| const fml::closure & | isolate_create_callback, | ||
| const fml::closure & | isolate_shutdown_callback, | ||
| std::shared_ptr< const fml::Mapping > | p_persistent_isolate_data, | ||
| const UIDartState::Context & | context | ||
| ) |
Creates a new instance of a runtime controller. This is usually only done by the engine instance associated with the shell.
| client | The runtime delegate. This is usually the Engine instance. | |
| vm | A reference to a running Dart VM. The runtime controller must be collected before the VM is destroyed (this order is guaranteed by the shell). | |
| [in] | idle_notification_callback | The idle notification callback. This allows callers to run native code in isolate scope when the VM is about to be notified that the engine is going to be idle. |
| [in] | platform_data | The window data (if exists). |
| [in] | isolate_create_callback | The isolate create callback. This allows callers to run native code in isolate scope on the UI task runner as soon as the root isolate has been created. |
| [in] | isolate_shutdown_callback | The isolate shutdown callback. This allows callers to run native code in isolate scoped on the UI task runner just as the root isolate is about to be torn down. |
| [in] | persistent_isolate_data | Unstructured persistent read-only data that the root isolate can access in a synchronous manner. |
| [in] | context | Engine-owned state which is accessed by the root dart isolate. |
Definition at line 29 of file runtime_controller.cc.
|
override |
Definition at line 92 of file runtime_controller.cc.
References FML_DCHECK, and FML_DLOG.
|
protected |
Constructor for Mocks.
Definition at line 22 of file runtime_controller.cc.
| void flutter::RuntimeController::AddView | ( | int64_t | view_id, |
| const ViewportMetrics & | view_metrics, | ||
| AddViewCallback | callback | ||
| ) |
Notify the isolate 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
is an error.
The `callback` is invoked when the add operation is attempted,
failed, or is cancelled.
If the isolate is not running, the view add will be queued and
flushed to the isolate when it starts. Calling `RemoveView`
before the isolate is launched cancels the add operation.
If the isolate is running, a frame will be scheduled.
| [in] | view_id | The ID of the new view. |
| [in] | viewport_metrics | The initial viewport metrics for the view. |
| [in] | callback | Callback that will be invoked after the add operation is attempted or cancelled. |
Definition at line 163 of file runtime_controller.cc.
References callback, FML_DCHECK, FML_LOG, view_id, and flutter::PlatformData::viewport_metrics_for_views.
| bool flutter::RuntimeController::BeginFrame | ( | fml::TimePoint | frame_time, |
| uint64_t | frame_number | ||
| ) |
Notifies the running isolate that it should start generating a new frame.
Engine::BeginFrame for more context.| [in] | frame_time | The point at which the current frame interval began. May be used by animation interpolators, physics simulations, etc. |
Definition at line 299 of file runtime_controller.cc.
| std::unique_ptr< RuntimeController > flutter::RuntimeController::Clone | ( | ) | const |
Clone the runtime controller. Launching an isolate with a cloned runtime controller will use the same snapshots and copies all window data to the new instance. This is usually only used in the debug runtime mode to support the cold-restart scenario.
Definition at line 113 of file runtime_controller.cc.
|
virtual |
Dispatch the specified platform message to running root isolate.
| [in] | message | The message to dispatch to the isolate. |
Definition at line 351 of file runtime_controller.cc.
References message, and TRACE_EVENT0.
| bool flutter::RuntimeController::DispatchPointerDataPacket | ( | const PointerDataPacket & | packet | ) |
Dispatch the specified pointer data message to the running root isolate.
| [in] | packet | The pointer data message to dispatch to the isolate. |
Definition at line 362 of file runtime_controller.cc.
References flutter::PointerDataPacketConverter::Convert(), and TRACE_EVENT0.
| bool flutter::RuntimeController::DispatchSemanticsAction | ( | int64_t | view_id, |
| int32_t | node_id, | ||
| SemanticsAction | action, | ||
| fml::MallocMapping | args | ||
| ) |
Dispatch the semantics action to the specified accessibility node.
| [in] | view_id | The identifier of the view. |
| [in] | node_id | The identifier of the accessibility node. |
| [in] | action | The semantics action to perform on the specified accessibility node. |
| [in] | args | Optional data that applies to the specified action. |
Definition at line 377 of file runtime_controller.cc.
References action, args, TRACE_EVENT1, and view_id.
|
inline |
Definition at line 670 of file runtime_controller.h.
|
inlinevirtual |
Definition at line 649 of file runtime_controller.h.
|
inline |
Definition at line 645 of file runtime_controller.h.
References flutter::UIDartState::Context::io_manager.
| std::string flutter::RuntimeController::GetIsolateName | ( | ) |
Gets the debug name of the root isolate. But default, the debug name of the isolate is derived from its advisory script URI, advisory main entrypoint and its main port name. For example, "main.dart$main-1234" where the script URI is "main.dart", the entrypoint is "main" and the port name "1234". Once launched, the isolate may re-christen itself using a name it selects via setIsolateDebugName in window.dart. This name is purely advisory and only used by instrumentation and reporting purposes.
Definition at line 507 of file runtime_controller.cc.
|
inline |
Definition at line 651 of file runtime_controller.h.
| tonic::DartErrorHandleType flutter::RuntimeController::GetLastError | ( | ) |
Get the last error encountered by the microtask queue.
Definition at line 529 of file runtime_controller.cc.
References tonic::kNoError.
| Dart_Port flutter::RuntimeController::GetMainPort | ( | ) |
Gets the main port identifier of the root isolate.
ILLEGAL_PORT. Definition at line 502 of file runtime_controller.cc.
|
overridevirtual |
The embedder can specify data that the isolate can request synchronously on launch. This accessor fetches that data.
This data is persistent for the duration of the Flutter application and is available even after isolate restarts. Because of this lifecycle, the size of this data must be kept to a minimum.
For asynchronous communication between the embedder and isolate, a platform channel may be used.
Implements flutter::PlatformConfigurationClient.
Definition at line 486 of file runtime_controller.cc.
|
inline |
Definition at line 655 of file runtime_controller.h.
|
inlineoverridevirtual |
Implements flutter::PlatformConfigurationClient.
Definition at line 676 of file runtime_controller.h.
|
inline |
Definition at line 666 of file runtime_controller.h.
| uint64_t flutter::RuntimeController::GetRootIsolateGroup | ( | ) | const |
Get an identifier that represents the Dart isolate group the root isolate is in.
Definition at line 618 of file runtime_controller.cc.
| std::optional< uint32_t > flutter::RuntimeController::GetRootIsolateReturnCode | ( | ) |
Get the return code specified by the root isolate (if one is present).
Definition at line 614 of file runtime_controller.cc.
| std::optional< std::string > flutter::RuntimeController::GetRootIsolateServiceID | ( | ) | const |
Get the service ID of the root isolate if the root isolate is running.
Definition at line 607 of file runtime_controller.cc.
|
inline |
Definition at line 657 of file runtime_controller.h.
References flutter::UIDartState::Context::unref_queue.
|
inline |
Definition at line 661 of file runtime_controller.h.
References flutter::UIDartState::Context::snapshot_delegate.
| bool flutter::RuntimeController::HasLivePorts | ( | ) |
Returns if the root isolate has any live receive ports.
Definition at line 512 of file runtime_controller.cc.
| bool flutter::RuntimeController::HasPendingMicrotasks | ( | ) |
Returns if the root isolate has any pending microtasks.
Definition at line 521 of file runtime_controller.cc.
|
virtual |
Returns if the root isolate is running. The isolate must be transitioned to the running phase manually. The isolate can stop running if it terminates execution on its own.
Definition at line 105 of file runtime_controller.cc.
References flutter::DartIsolate::Running.
| bool flutter::RuntimeController::LaunchRootIsolate | ( | const Settings & | settings, |
| const fml::closure & | root_isolate_create_callback, | ||
| std::optional< std::string > | dart_entrypoint, | ||
| std::optional< std::string > | dart_entrypoint_library, | ||
| const std::vector< std::string > & | dart_entrypoint_args, | ||
| std::unique_ptr< IsolateConfiguration > | isolate_configuration, | ||
| std::shared_ptr< NativeAssetsManager > | native_assets_manager, | ||
| std::optional< int64_t > | engine_id | ||
| ) |
Launches the isolate using the window data associated with this runtime controller. Before this call, the Dart isolate has not been initialized. On successful return, the caller can assume that the isolate is in the DartIsolate::Phase::Running phase.
This call will fail if a root isolate is already running. To re-create an isolate with the window data associated with this runtime controller, Clone this runtime controller and Launch an isolate in that runtime controller instead.
| [in] | settings | The per engine instance settings. |
| [in] | root_isolate_create_callback | A callback invoked before the root isolate has launched the Dart program, but after it has been created. This is called without isolate scope, and after any root isolate callback in the settings. |
| [in] | dart_entrypoint | The dart entrypoint. If std::nullopt or empty, main will be attempted. |
| [in] | dart_entrypoint_library | The dart entrypoint library. If std::nullopt or empty, the core library will be attempted. |
| [in] | dart_entrypoint_args | Arguments passed as a List<String> to Dart's entrypoint function. |
| [in] | isolate_configuration | The isolate configuration |
| [in] | engine_id. | Engine identifier to be passed to the platform dispatcher. |
DartIsolate::Phase::Running phase. Definition at line 534 of file runtime_controller.cc.
References flutter::DartIsolate::CreateRunningRootIsolate(), FML_DCHECK, FML_DLOG, FML_LOG, flutter::RuntimeDelegate::GetPlatformMessageHandler(), and flutter::RuntimeDelegate::OnRootIsolateCreated().
| void flutter::RuntimeController::LoadDartDeferredLibrary | ( | intptr_t | loading_unit_id, |
| std::unique_ptr< const fml::Mapping > | snapshot_data, | ||
| std::unique_ptr< const fml::Mapping > | snapshot_instructions | ||
| ) |
Loads the Dart shared library into the Dart VM. When the Dart library is loaded successfully, the Dart future returned by the originating loadLibrary() call completes.
The Dart compiler may generate separate shared libraries files called 'loading units' when libraries are imported as deferred. Each of these shared libraries are identified by a unique loading unit id. Callers should open and resolve a SymbolMapping from the shared library. The Mappings should be moved into this method, as ownership will be assumed by the dart root isolate after successful loading and released after shutdown of the root isolate. The loading unit may not be used after isolate shutdown. If loading fails, the mappings will be released.
This method is paired with a RequestDartDeferredLibrary invocation that provides the embedder with the loading unit id of the deferred library to load.
| [in] | loading_unit_id | The unique id of the deferred library's loading unit, as passed in by RequestDartDeferredLibrary. |
| [in] | snapshot_data | Dart snapshot data of the loading unit's shared library. |
| [in] | snapshot_data | Dart snapshot instructions of the loading unit's shared library. |
Definition at line 629 of file runtime_controller.cc.
|
virtual |
Indicates to the dart VM that the request to load a deferred library with the specified loading unit id has failed.
The dart future returned by the initiating loadLibrary() call will complete with an error.
| [in] | loading_unit_id | The unique id of the deferred library's loading unit, as passed in by RequestDartDeferredLibrary. |
| [in] | error_message | The error message that will appear in the dart Future. |
| [in] | transient | A transient error is a failure due to temporary conditions such as no network. Transient errors allow the dart VM to re-request the same deferred library and loading_unit_id again. Non-transient errors are permanent and attempts to re-request the library will instantly complete with an error. |
Definition at line 638 of file runtime_controller.cc.
|
virtual |
Notify the Dart VM that no frame workloads are expected on the UI task runner till the specified deadline. The VM uses this opportunity to perform garbage collection operations is a manner that interferes as little as possible with frame rendering.
NotifyIdle is advisory. The VM may or may not run a garbage collection when this is called, and will eventually perform garbage collections even if it is not called or it is called with insufficient deadlines.
The garbage collection mechanism and its thresholds are internal implementation details and absolutely no guarantees are made about the threshold discussed below. This discussion is also an oversimplification but hopefully serves to calibrate expectations about GC behavior:
Dart_TimelineGetMicros| [in] | deadline | The deadline is used by the VM to determine if the corresponding sweep can be performed within the deadline. |
Definition at line 319 of file runtime_controller.cc.
References fml::TimeDelta::FromMicroseconds(), fml::TimeDelta::FromMilliseconds(), flutter::PlatformConfigurationNativeApi::GetDartPerformanceMode(), fml::TimeDelta::ToMicroseconds(), and TRACE_EVENT0.
Referenced by flutter::testing::TEST_F().
| bool flutter::RuntimeController::RemoveView | ( | int64_t | view_id | ) |
Notify the isolate that a view is no longer available.
Views that are added before the isolate is started are
queued until the isolate is launched. If one of these
"pending" views are removed, the view add is cancelled:
the `AddViewCallback` will be invoked with an `added` of
false and `RemoveView` will return false.
The implicit view (kFlutterImplicitViewId) should never be
removed. Doing so triggers an assertion.
| [in] | view_id | The ID of the view. |
Definition at line 195 of file runtime_controller.cc.
References FML_DCHECK, view_id, and flutter::PlatformData::viewport_metrics_for_views.
| bool flutter::RuntimeController::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 Dart code running on the engine by invoking this method at predefined intervals.
Engine::ReportTimings, FrameTiming| [in] | timings | Collection of FrameTiming::kCount * n timestamps for n frames whose timings have not been reported yet. 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 310 of file runtime_controller.cc.
|
overridevirtual |
Invoked when the Dart VM requests that a deferred library be loaded. Notifies the engine that the deferred library identified by the specified loading unit id should be downloaded and loaded into the Dart VM via LoadDartDeferredLibrary
Upon encountering errors or otherwise failing to load a loading unit with the specified id, the failure should be directly reported to dart by calling LoadDartDeferredLibraryFailure to ensure the waiting dart future completes with an error.
| [in] | loading_unit_id | The unique id of the deferred library's loading unit. This id is to be passed back into LoadDartDeferredLibrary in order to identify which deferred library to load. |
Implements flutter::PlatformConfigurationClient.
Definition at line 647 of file runtime_controller.cc.
References flutter::RuntimeDelegate::RequestDartDeferredLibrary().
| bool flutter::RuntimeController::SendViewFocusEvent | ( | const ViewFocusEvent & | event | ) |
Notify the isolate that the focus state of a native view has changed.
| [in] | event | The focus event describing the change. |
Definition at line 216 of file runtime_controller.cc.
| bool flutter::RuntimeController::SetAccessibilityFeatures | ( | int32_t | flags | ) |
Forward the preference of accessibility features that must be enabled in the semantics tree to the running isolate. If the isolate is not running, this data will be saved and flushed to the isolate when it starts running.
| [in] | flags | The accessibility features that must be generated in the semantics tree. |
Definition at line 288 of file runtime_controller.cc.
References flutter::PlatformData::accessibility_feature_flags_.
|
overridevirtual |
Framework sets the application locale.
| [in] | locale | The application locale in BCP 47 format. |
Implements flutter::PlatformConfigurationClient.
Definition at line 448 of file runtime_controller.cc.
References flutter::RuntimeDelegate::SetApplicationLocale().
Referenced by flutter::testing::RuntimeControllerTester::CanUpdateSetApplicationLocale().
| bool flutter::RuntimeController::SetDisplays | ( | const std::vector< DisplayData > & | displays | ) |
Forward the specified display metrics to the running isolate. If the isolate is not running, these metrics will be saved and flushed to the isolate when it starts.
| [in] | displays | The available displays. |
Definition at line 651 of file runtime_controller.cc.
References flutter::PlatformData::displays, displays, and TRACE_EVENT0.
| bool flutter::RuntimeController::SetInitialLifecycleState | ( | const std::string & | data | ) |
Forward the initial lifecycle state data to the running isolate. If the isolate is not running, this data will be saved and flushed to the isolate when it starts running. After the isolate starts running, the current lifecycle state is pushed to it via the "flutter/lifecycle" channel.
| [in] | data | The lifecycle state data. |
Definition at line 264 of file runtime_controller.cc.
References flutter::data, and flutter::PlatformData::lifecycle_state.
| bool flutter::RuntimeController::SetLocales | ( | const std::vector< std::string > & | locale_data | ) |
Forward the specified locale data to the running isolate. If the isolate is not running, this data will be saved and flushed to the isolate when it starts running.
| [in] | locale_data | The locale data. This should consist of groups of 4 strings, each group representing a single locale. |
Definition at line 240 of file runtime_controller.cc.
References flutter::PlatformData::locale_data.
| void flutter::RuntimeController::SetRootIsolateOwnerToCurrentThread | ( | ) |
Definition at line 676 of file runtime_controller.cc.
| bool flutter::RuntimeController::SetSemanticsEnabled | ( | bool | enabled | ) |
Notifies the running isolate about whether the semantics tree should be generated or not. If the isolate is not running, this preference will be saved and flushed to the isolate when it starts running.
| [in] | enabled | Indicates whether to generate the semantics tree. |
Definition at line 276 of file runtime_controller.cc.
References flutter::PlatformData::semantics_enabled.
|
overridevirtual |
Notifies whether Framework starts generating semantics tree.
| [in] | enabled | True if Framework starts generating semantics tree. |
Implements flutter::PlatformConfigurationClient.
Definition at line 453 of file runtime_controller.cc.
References flutter::RuntimeDelegate::SetSemanticsTreeEnabled().
Referenced by flutter::testing::RuntimeControllerTester::CanUpdateSemanticsWhenSetSemanticsTreeEnabled().
| bool flutter::RuntimeController::SetUserSettingsData | ( | const std::string & | data | ) |
Forward the user settings data to the running isolate. If the isolate is not running, this data will be saved and flushed to the isolate when it starts running.
| [in] | data | The user settings data. |
Definition at line 252 of file runtime_controller.cc.
References flutter::data, and flutter::PlatformData::user_settings_data.
| bool flutter::RuntimeController::SetViewportMetrics | ( | int64_t | view_id, |
| const ViewportMetrics & | metrics | ||
| ) |
Forward the specified viewport metrics to the running isolate. If the isolate is not running, these metrics will be saved and flushed to the isolate when it starts.
| [in] | view_id | The ID for the view that metrics describes. |
| [in] | metrics | The window's viewport metrics. |
Definition at line 228 of file runtime_controller.cc.
References TRACE_EVENT0, view_id, and flutter::PlatformData::viewport_metrics_for_views.
| void flutter::RuntimeController::ShutdownPlatformIsolates | ( | ) |
Shuts down all registered platform isolates. Must be called from the platform thread.
Definition at line 672 of file runtime_controller.cc.
| std::unique_ptr< RuntimeController > flutter::RuntimeController::Spawn | ( | RuntimeDelegate & | p_client, |
| const std::string & | advisory_script_uri, | ||
| const std::string & | advisory_script_entrypoint, | ||
| const std::function< void(int64_t)> & | idle_notification_callback, | ||
| const fml::closure & | isolate_create_callback, | ||
| const fml::closure & | isolate_shutdown_callback, | ||
| const std::shared_ptr< const fml::Mapping > & | persistent_isolate_data, | ||
| fml::WeakPtr< IOManager > | io_manager, | ||
| fml::TaskRunnerAffineWeakPtr< ImageDecoder > | image_decoder, | ||
| fml::TaskRunnerAffineWeakPtr< ImageGeneratorRegistry > | image_generator_registry, | ||
| fml::TaskRunnerAffineWeakPtr< SnapshotDelegate > | snapshot_delegate | ||
| ) | const |
Create a RuntimeController that shares as many resources as possible with the calling RuntimeController such that together they occupy less memory.
Definition at line 50 of file runtime_controller.cc.
References flutter::UIDartState::Context::concurrent_task_runner, flutter::UIDartState::Context::deterministic_rendering_enabled, flutter::UIDartState::Context::enable_flutter_gpu, flutter::UIDartState::Context::enable_impeller, flutter::UIDartState::Context::runtime_stage_backend, flutter::UIDartState::Context::task_runners, and flutter::UIDartState::Context::unref_queue.
|
overridevirtual |
Receives an updated semantics tree from the Framework.
| [in] | viewId | The identifier of the view to update. |
| [in] | update | The updated semantic tree to apply. |
Implements flutter::PlatformConfigurationClient.
Definition at line 442 of file runtime_controller.cc.
References flutter::SemanticsUpdate::takeActions(), flutter::SemanticsUpdate::takeNodes(), flutter::RuntimeDelegate::UpdateSemantics(), and view_id.
Referenced by flutter::testing::RuntimeControllerTester::CanUpdateSemanticsWhenSetSemanticsTreeEnabled().