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 631 of file platform_configuration.h.

Member Function Documentation

◆ ComputePlatformResolvedLocale()

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

Definition at line 708 of file platform_configuration.cc.

709 {
711 std::vector<std::string> supportedLocales =
713 supportedLocalesHandle);
714
715 std::vector<std::string> results =
718 ->client()
719 ->ComputePlatformResolvedLocale(supportedLocales);
720
721 return tonic::DartConverter<std::vector<std::string>>::ToDart(results);
722}
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 649 of file platform_configuration.cc.

649 {
650 return current_performance_mode_;
651}

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

◆ GetPersistentIsolateData()

Dart_Handle flutter::PlatformConfigurationNativeApi::GetPersistentIsolateData ( )
static

Definition at line 659 of file platform_configuration.cc.

659 {
661
662 auto persistent_isolate_data = UIDartState::Current()
664 ->client()
666
667 if (!persistent_isolate_data) {
668 return Dart_Null();
669 }
670
671 return tonic::DartByteData::Create(persistent_isolate_data->GetMapping(),
672 persistent_isolate_data->GetSize());
673}
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 732 of file platform_configuration.cc.

732 {
733 UIDartState* dart_state = UIDartState::Current();
734 FML_DCHECK(dart_state);
735 return dart_state->GetRootIsolateToken();
736}
#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 757 of file platform_configuration.cc.

759 {
761 return UIDartState::Current()
763 ->client()
764 ->GetScaledFontSize(unscaled_font_size, configuration_id);
765}
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 738 of file platform_configuration.cc.

739 {
740 UIDartState* dart_state = UIDartState::Current();
741 FML_DCHECK(dart_state && !dart_state->IsRootIsolate());
742 auto platform_message_handler =
743 (*static_cast<std::shared_ptr<PlatformMessageHandlerStorage>*>(
744 Dart_CurrentIsolateGroupData()));
745 FML_DCHECK(platform_message_handler);
746 auto weak_platform_message_handler =
747 platform_message_handler->GetPlatformMessageHandler(root_isolate_token);
748 dart_state->SetPlatformMessageHandler(weak_platform_message_handler);
749}

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

535 {
538 view_id, scene, width, height);
539}
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 653 of file platform_configuration.cc.

653 {
655 current_performance_mode_ = static_cast<Dart_PerformanceMode>(mode);
656 return Dart_SetPerformanceMode(current_performance_mode_);
657}
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 611 of file platform_configuration.cc.

613 {
614 ViewFocusChangeRequest request{view_id, //
615 static_cast<ViewFocusState>(state),
616 static_cast<ViewFocusDirection>(direction)};
617 UIDartState* dart_state = UIDartState::Current();
618 dart_state->platform_configuration()->client()->RequestViewFocusChange(
619 request);
620}
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 622 of file platform_configuration.cc.

624 {
625 if (Dart_IsNull(data.dart_handle())) {
629 } else {
630 // TODO(engine): Avoid this copy.
631 const uint8_t* buffer = static_cast<const uint8_t*>(data.data());
635 response_id,
636 std::vector<uint8_t>(buffer, buffer + data.length_in_bytes()));
637 }
638}
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 751 of file platform_configuration.cc.

752 {
754 name, listening);
755}
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 568 of file platform_configuration.cc.

571 {
572 UIDartState* dart_state = UIDartState::Current();
573
574 if (!dart_state->platform_configuration()) {
575 return tonic::ToDart(
576 "SendPlatformMessage only works on the root isolate, see "
577 "SendPortPlatformMessage.");
578 }
579
581 if (!Dart_IsNull(callback)) {
582 response = fml::MakeRefCounted<PlatformMessageResponseDart>(
584 dart_state->GetTaskRunners().GetUITaskRunner(), name);
585 }
586
587 return HandlePlatformMessage(dart_state, name, data_handle, response);
588}
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 590 of file platform_configuration.cc.

594 {
595 // This can be executed on any isolate.
596 UIDartState* dart_state = UIDartState::Current();
597
598 int64_t c_send_port = tonic::DartConverter<int64_t>::FromDart(send_port);
599 if (c_send_port == ILLEGAL_PORT) {
600 return tonic::ToDart("Invalid port specified");
601 }
602
604 fml::MakeRefCounted<PlatformMessageResponseDartPort>(
605 c_send_port, tonic::DartConverter<int64_t>::FromDart(identifier),
606 name);
607
608 return HandlePlatformMessage(dart_state, name, data_handle, response);
609}

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: