Flutter Engine
 
Loading...
Searching...
No Matches
flutter::PlatformConfigurationNativeApi Class Reference

#include <platform_configuration.h>

Static Public Member Functions

static std::string DefaultRouteName ()
 
static void ScheduleFrame ()
 
static void EndWarmUpFrame ()
 
static void Render (int64_t view_id, Scene *scene, double width, double height)
 
static void UpdateSemantics (int64_t viewId, SemanticsUpdate *update)
 
static void SetApplicationLocale (std::string locale)
 
static void SetSemanticsTreeEnabled (bool enabled)
 
static void SetNeedsReportTimings (bool value)
 
static Dart_Handle GetPersistentIsolateData ()
 
static Dart_Handle ComputePlatformResolvedLocale (Dart_Handle supportedLocalesHandle)
 
static void SetIsolateDebugName (const std::string &name)
 
static Dart_Handle SendPlatformMessage (const std::string &name, Dart_Handle callback, Dart_Handle data_handle)
 
static Dart_Handle SendPortPlatformMessage (const std::string &name, Dart_Handle identifier, Dart_Handle send_port, Dart_Handle data_handle)
 
static void RespondToPlatformMessage (int response_id, const tonic::DartByteData &data)
 
static void SendChannelUpdate (const std::string &name, bool listening)
 
static void RequestViewFocusChange (int64_t view_id, int64_t state, int64_t direction)
 
static int RequestDartPerformanceMode (int mode)
 Requests the Dart VM to adjusts the GC heuristics based on the requested performance_mode. Returns the old performance mode.
 
static Dart_PerformanceMode GetDartPerformanceMode ()
 Returns the current performance mode of the Dart VM. Defaults to Dart_PerformanceMode_Default if no prior requests to change the performance mode have been made.
 
static int64_t GetRootIsolateToken ()
 
static void RegisterBackgroundIsolate (int64_t root_isolate_token)
 
static double GetScaledFontSize (double unscaled_font_size, int configuration_id)
 

Detailed Description

Definition at line 628 of file platform_configuration.h.

Member Function Documentation

◆ ComputePlatformResolvedLocale()

Dart_Handle flutter::PlatformConfigurationNativeApi::ComputePlatformResolvedLocale ( Dart_Handle  supportedLocalesHandle)
static

Definition at line 696 of file platform_configuration.cc.

697 {
699 std::vector<std::string> supportedLocales =
701 supportedLocalesHandle);
702
703 std::vector<std::string> results =
706 ->client()
707 ->ComputePlatformResolvedLocale(supportedLocales);
708
709 return tonic::DartConverter<std::vector<std::string>>::ToDart(results);
710}
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...
PlatformConfigurationClient * client() const
Access to the platform configuration client (which typically is implemented by the RuntimeController)...
PlatformConfiguration * platform_configuration() const
static UIDartState * Current()
static void ThrowIfUIOperationsProhibited()

References flutter::PlatformConfiguration::client(), flutter::PlatformConfigurationClient::ComputePlatformResolvedLocale(), flutter::UIDartState::Current(), flutter::UIDartState::platform_configuration(), and flutter::UIDartState::ThrowIfUIOperationsProhibited().

◆ DefaultRouteName()

std::string flutter::PlatformConfigurationNativeApi::DefaultRouteName ( )
static

◆ EndWarmUpFrame()

◆ GetDartPerformanceMode()

Dart_PerformanceMode flutter::PlatformConfigurationNativeApi::GetDartPerformanceMode ( )
static

Returns the current performance mode of the Dart VM. Defaults to Dart_PerformanceMode_Default if no prior requests to change the performance mode have been made.

Definition at line 637 of file platform_configuration.cc.

637 {
638 return current_performance_mode_;
639}

Referenced by flutter::RuntimeController::NotifyIdle().

◆ GetPersistentIsolateData()

Dart_Handle flutter::PlatformConfigurationNativeApi::GetPersistentIsolateData ( )
static

Definition at line 647 of file platform_configuration.cc.

647 {
649
650 auto persistent_isolate_data = UIDartState::Current()
652 ->client()
654
655 if (!persistent_isolate_data) {
656 return Dart_Null();
657 }
658
659 return tonic::DartByteData::Create(persistent_isolate_data->GetMapping(),
660 persistent_isolate_data->GetSize());
661}
virtual std::shared_ptr< const fml::Mapping > GetPersistentIsolateData()=0
The embedder can specify data that the isolate can request synchronously on launch....
static Dart_Handle Create(const void *data, size_t length)

References flutter::PlatformConfiguration::client(), tonic::DartByteData::Create(), flutter::UIDartState::Current(), flutter::PlatformConfigurationClient::GetPersistentIsolateData(), flutter::UIDartState::platform_configuration(), and flutter::UIDartState::ThrowIfUIOperationsProhibited().

◆ GetRootIsolateToken()

int64_t flutter::PlatformConfigurationNativeApi::GetRootIsolateToken ( )
static

Definition at line 720 of file platform_configuration.cc.

720 {
721 UIDartState* dart_state = UIDartState::Current();
722 FML_DCHECK(dart_state);
723 return dart_state->GetRootIsolateToken();
724}
#define FML_DCHECK(condition)
Definition logging.h:122

References flutter::UIDartState::Current(), FML_DCHECK, and flutter::UIDartState::GetRootIsolateToken().

◆ GetScaledFontSize()

double flutter::PlatformConfigurationNativeApi::GetScaledFontSize ( double  unscaled_font_size,
int  configuration_id 
)
static

Definition at line 745 of file platform_configuration.cc.

747 {
749 return UIDartState::Current()
751 ->client()
752 ->GetScaledFontSize(unscaled_font_size, configuration_id);
753}
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...

References flutter::PlatformConfiguration::client(), flutter::UIDartState::Current(), flutter::PlatformConfigurationClient::GetScaledFontSize(), flutter::UIDartState::platform_configuration(), and flutter::UIDartState::ThrowIfUIOperationsProhibited().

◆ RegisterBackgroundIsolate()

void flutter::PlatformConfigurationNativeApi::RegisterBackgroundIsolate ( int64_t  root_isolate_token)
static

Definition at line 726 of file platform_configuration.cc.

727 {
728 UIDartState* dart_state = UIDartState::Current();
729 FML_DCHECK(dart_state && !dart_state->IsRootIsolate());
730 auto platform_message_handler =
731 (*static_cast<std::shared_ptr<PlatformMessageHandlerStorage>*>(
732 Dart_CurrentIsolateGroupData()));
733 FML_DCHECK(platform_message_handler);
734 auto weak_platform_message_handler =
735 platform_message_handler->GetPlatformMessageHandler(root_isolate_token);
736 dart_state->SetPlatformMessageHandler(weak_platform_message_handler);
737}

References flutter::UIDartState::Current(), FML_DCHECK, flutter::UIDartState::IsRootIsolate(), and flutter::UIDartState::SetPlatformMessageHandler().

◆ Render()

void flutter::PlatformConfigurationNativeApi::Render ( int64_t  view_id,
Scene scene,
double  width,
double  height 
)
static

Definition at line 520 of file platform_configuration.cc.

523 {
526 view_id, scene, width, height);
527}
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.
G_BEGIN_DECLS FlutterViewId view_id
int32_t height
int32_t width

References flutter::PlatformConfiguration::client(), flutter::UIDartState::Current(), height, flutter::UIDartState::platform_configuration(), flutter::PlatformConfigurationClient::Render(), flutter::UIDartState::ThrowIfUIOperationsProhibited(), view_id, and width.

◆ RequestDartPerformanceMode()

int flutter::PlatformConfigurationNativeApi::RequestDartPerformanceMode ( int  mode)
static

Requests the Dart VM to adjusts the GC heuristics based on the requested performance_mode. Returns the old performance mode.

Requesting a performance mode doesn't guarantee any performance characteristics. This is best effort, and should be used after careful consideration of the various GC trade-offs.

Parameters
[in]performance_modeThe requested performance mode. Please refer to documentation of Dart_PerformanceMode for more details about what each performance mode does.

Definition at line 641 of file platform_configuration.cc.

641 {
643 current_performance_mode_ = static_cast<Dart_PerformanceMode>(mode);
644 return Dart_SetPerformanceMode(current_performance_mode_);
645}
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all 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

References flutter::mode, and flutter::UIDartState::ThrowIfUIOperationsProhibited().

◆ RequestViewFocusChange()

void flutter::PlatformConfigurationNativeApi::RequestViewFocusChange ( int64_t  view_id,
int64_t  state,
int64_t  direction 
)
static

Definition at line 599 of file platform_configuration.cc.

601 {
602 ViewFocusChangeRequest request{view_id, //
603 static_cast<ViewFocusState>(state),
604 static_cast<ViewFocusDirection>(direction)};
605 UIDartState* dart_state = UIDartState::Current();
606 dart_state->platform_configuration()->client()->RequestViewFocusChange(
607 request);
608}
ViewFocusDirection
Definition view_focus.h:22

References flutter::PlatformConfiguration::client(), flutter::UIDartState::Current(), flutter::UIDartState::platform_configuration(), flutter::PlatformConfigurationClient::RequestViewFocusChange(), and view_id.

◆ RespondToPlatformMessage()

void flutter::PlatformConfigurationNativeApi::RespondToPlatformMessage ( int  response_id,
const tonic::DartByteData data 
)
static

Definition at line 610 of file platform_configuration.cc.

612 {
613 if (Dart_IsNull(data.dart_handle())) {
617 } else {
618 // TODO(engine): Avoid this copy.
619 const uint8_t* buffer = static_cast<const uint8_t*>(data.data());
623 response_id,
624 std::vector<uint8_t>(buffer, buffer + data.length_in_bytes()));
625 }
626}
void CompletePlatformMessageResponse(int response_id, std::vector< uint8_t > data)
Responds to a previous platform message to the engine from the framework.
void CompletePlatformMessageEmptyResponse(int response_id)
Responds to a previous platform message to the engine from the framework with an empty response.
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 switch_defs.h:36
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set profile Make the profiler discard new samples once the profiler sample buffer is full When this flag is not the profiler sample buffer is used as a ring buffer
Definition switch_defs.h:98

References flutter::buffer, flutter::PlatformConfiguration::CompletePlatformMessageEmptyResponse(), flutter::PlatformConfiguration::CompletePlatformMessageResponse(), flutter::UIDartState::Current(), flutter::data, and flutter::UIDartState::platform_configuration().

◆ ScheduleFrame()

void flutter::PlatformConfigurationNativeApi::ScheduleFrame ( )
static

◆ SendChannelUpdate()

void flutter::PlatformConfigurationNativeApi::SendChannelUpdate ( const std::string &  name,
bool  listening 
)
static

Definition at line 739 of file platform_configuration.cc.

740 {
742 name, listening);
743}
virtual void SendChannelUpdate(std::string name, bool listening)=0
Invoked when a listener is registered on a platform channel.
DEF_SWITCHES_START aot vmservice shared library name
Definition switch_defs.h:27

References flutter::PlatformConfiguration::client(), flutter::UIDartState::Current(), flutter::name, flutter::UIDartState::platform_configuration(), and flutter::PlatformConfigurationClient::SendChannelUpdate().

◆ SendPlatformMessage()

Dart_Handle flutter::PlatformConfigurationNativeApi::SendPlatformMessage ( const std::string &  name,
Dart_Handle  callback,
Dart_Handle  data_handle 
)
static

Definition at line 556 of file platform_configuration.cc.

559 {
560 UIDartState* dart_state = UIDartState::Current();
561
562 if (!dart_state->platform_configuration()) {
563 return tonic::ToDart(
564 "SendPlatformMessage only works on the root isolate, see "
565 "SendPortPlatformMessage.");
566 }
567
569 if (!Dart_IsNull(callback)) {
570 response = fml::MakeRefCounted<PlatformMessageResponseDart>(
572 dart_state->GetTaskRunners().GetUITaskRunner(), name);
573 }
574
575 return HandlePlatformMessage(dart_state, name, data_handle, response);
576}
FlutterDesktopBinaryReply callback
Dart_Handle ToDart(const T &object)

References callback, flutter::UIDartState::Current(), flutter::UIDartState::GetTaskRunners(), flutter::TaskRunners::GetUITaskRunner(), flutter::name, flutter::UIDartState::platform_configuration(), and tonic::ToDart().

◆ SendPortPlatformMessage()

Dart_Handle flutter::PlatformConfigurationNativeApi::SendPortPlatformMessage ( const std::string &  name,
Dart_Handle  identifier,
Dart_Handle  send_port,
Dart_Handle  data_handle 
)
static

Definition at line 578 of file platform_configuration.cc.

582 {
583 // This can be executed on any isolate.
584 UIDartState* dart_state = UIDartState::Current();
585
586 int64_t c_send_port = tonic::DartConverter<int64_t>::FromDart(send_port);
587 if (c_send_port == ILLEGAL_PORT) {
588 return tonic::ToDart("Invalid port specified");
589 }
590
592 fml::MakeRefCounted<PlatformMessageResponseDartPort>(
593 c_send_port, tonic::DartConverter<int64_t>::FromDart(identifier),
594 name);
595
596 return HandlePlatformMessage(dart_state, name, data_handle, response);
597}

References flutter::UIDartState::Current(), flutter::name, and tonic::ToDart().

◆ SetApplicationLocale()

void flutter::PlatformConfigurationNativeApi::SetApplicationLocale ( std::string  locale)
static

◆ SetIsolateDebugName()

void flutter::PlatformConfigurationNativeApi::SetIsolateDebugName ( const std::string &  name)
static

◆ SetNeedsReportTimings()

void flutter::PlatformConfigurationNativeApi::SetNeedsReportTimings ( bool  value)
static

◆ SetSemanticsTreeEnabled()

void flutter::PlatformConfigurationNativeApi::SetSemanticsTreeEnabled ( bool  enabled)
static

◆ UpdateSemantics()

void flutter::PlatformConfigurationNativeApi::UpdateSemantics ( int64_t  viewId,
SemanticsUpdate update 
)
static

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