Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
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 645 of file platform_configuration.h.

Member Function Documentation

◆ ComputePlatformResolvedLocale()

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

Definition at line 735 of file platform_configuration.cc.

736 {
738 std::vector<std::string> supportedLocales =
740 supportedLocalesHandle);
741
742 std::vector<std::string> results =
745 ->client()
746 ->ComputePlatformResolvedLocale(supportedLocales);
747
748 return tonic::DartConverter<std::vector<std::string>>::ToDart(results);
749}
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 676 of file platform_configuration.cc.

676 {
677 return current_performance_mode_;
678}

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

◆ GetPersistentIsolateData()

Dart_Handle flutter::PlatformConfigurationNativeApi::GetPersistentIsolateData ( )
static

Definition at line 686 of file platform_configuration.cc.

686 {
688
689 auto persistent_isolate_data = UIDartState::Current()
691 ->client()
693
694 if (!persistent_isolate_data) {
695 return Dart_Null();
696 }
697
698 return tonic::DartByteData::Create(persistent_isolate_data->GetMapping(),
699 persistent_isolate_data->GetSize());
700}
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 759 of file platform_configuration.cc.

759 {
760 UIDartState* dart_state = UIDartState::Current();
761 FML_DCHECK(dart_state);
762 return dart_state->GetRootIsolateToken();
763}
#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 784 of file platform_configuration.cc.

786 {
788 return UIDartState::Current()
790 ->client()
791 ->GetScaledFontSize(unscaled_font_size, configuration_id);
792}
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 765 of file platform_configuration.cc.

766 {
767 UIDartState* dart_state = UIDartState::Current();
768 FML_DCHECK(dart_state && !dart_state->IsRootIsolate());
769 auto platform_message_handler =
770 (*static_cast<std::shared_ptr<PlatformMessageHandlerStorage>*>(
771 Dart_CurrentIsolateGroupData()));
772 FML_DCHECK(platform_message_handler);
773 auto weak_platform_message_handler =
774 platform_message_handler->GetPlatformMessageHandler(root_isolate_token);
775 dart_state->SetPlatformMessageHandler(weak_platform_message_handler);
776}

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 559 of file platform_configuration.cc.

562 {
565 view_id, scene, width, height);
566}
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 680 of file platform_configuration.cc.

680 {
682 current_performance_mode_ = static_cast<Dart_PerformanceMode>(mode);
683 return Dart_SetPerformanceMode(current_performance_mode_);
684}
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 638 of file platform_configuration.cc.

640 {
641 ViewFocusChangeRequest request{view_id, //
642 static_cast<ViewFocusState>(state),
643 static_cast<ViewFocusDirection>(direction)};
644 UIDartState* dart_state = UIDartState::Current();
645 dart_state->platform_configuration()->client()->RequestViewFocusChange(
646 request);
647}
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 649 of file platform_configuration.cc.

651 {
652 if (Dart_IsNull(data.dart_handle())) {
656 } else {
657 // TODO(engine): Avoid this copy.
658 const uint8_t* buffer = static_cast<const uint8_t*>(data.data());
662 response_id,
663 std::vector<uint8_t>(buffer, buffer + data.length_in_bytes()));
664 }
665}
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 778 of file platform_configuration.cc.

779 {
781 name, listening);
782}
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 595 of file platform_configuration.cc.

598 {
599 UIDartState* dart_state = UIDartState::Current();
600
601 if (!dart_state->platform_configuration()) {
602 return tonic::ToDart(
603 "SendPlatformMessage only works on the root isolate, see "
604 "SendPortPlatformMessage.");
605 }
606
608 if (!Dart_IsNull(callback)) {
609 response = fml::MakeRefCounted<PlatformMessageResponseDart>(
611 dart_state->GetTaskRunners().GetUITaskRunner(), name);
612 }
613
614 return HandlePlatformMessage(dart_state, name, data_handle, response);
615}
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 617 of file platform_configuration.cc.

621 {
622 // This can be executed on any isolate.
623 UIDartState* dart_state = UIDartState::Current();
624
625 int64_t c_send_port = tonic::DartConverter<int64_t>::FromDart(send_port);
626 if (c_send_port == ILLEGAL_PORT) {
627 return tonic::ToDart("Invalid port specified");
628 }
629
631 fml::MakeRefCounted<PlatformMessageResponseDartPort>(
632 c_send_port, tonic::DartConverter<int64_t>::FromDart(identifier),
633 name);
634
635 return HandlePlatformMessage(dart_state, name, data_handle, response);
636}

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: