Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
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 (SemanticsUpdate *update)
 
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 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 571 of file platform_configuration.h.

Member Function Documentation

◆ ComputePlatformResolvedLocale()

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

Definition at line 606 of file platform_configuration.cc.

607 {
609 std::vector<std::string> supportedLocales =
611 supportedLocalesHandle);
612
613 std::vector<std::string> results =
616 ->client()
617 ->ComputePlatformResolvedLocale(supportedLocales);
618
619 return tonic::DartConverter<std::vector<std::string>>::ToDart(results);
620}
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()

◆ DefaultRouteName()

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

Definition at line 622 of file platform_configuration.cc.

622 {
624 return UIDartState::Current()
626 ->client()
628}
virtual std::string DefaultRouteName()=0
The route or path that the embedder requested when the application was launched.

◆ EndWarmUpFrame()

void flutter::PlatformConfigurationNativeApi::EndWarmUpFrame ( )
static

Definition at line 595 of file platform_configuration.cc.

595 {
598}
virtual void EndWarmUpFrame()=0
Called when a warm up frame has ended.

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

564 {
565 return current_performance_mode_;
566}

◆ GetPersistentIsolateData()

Dart_Handle flutter::PlatformConfigurationNativeApi::GetPersistentIsolateData ( )
static

Definition at line 574 of file platform_configuration.cc.

574 {
576
577 auto persistent_isolate_data = UIDartState::Current()
579 ->client()
581
582 if (!persistent_isolate_data) {
583 return Dart_Null();
584 }
585
586 return tonic::DartByteData::Create(persistent_isolate_data->GetMapping(),
587 persistent_isolate_data->GetSize());
588}
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)
DART_EXPORT Dart_Handle Dart_Null(void)

◆ GetRootIsolateToken()

int64_t flutter::PlatformConfigurationNativeApi::GetRootIsolateToken ( )
static

Definition at line 630 of file platform_configuration.cc.

630 {
631 UIDartState* dart_state = UIDartState::Current();
632 FML_DCHECK(dart_state);
633 return dart_state->GetRootIsolateToken();
634}
#define FML_DCHECK(condition)
Definition logging.h:103

◆ GetScaledFontSize()

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

Definition at line 655 of file platform_configuration.cc.

657 {
659 return UIDartState::Current()
661 ->client()
662 ->GetScaledFontSize(unscaled_font_size, configuration_id);
663}
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...

◆ RegisterBackgroundIsolate()

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

Definition at line 636 of file platform_configuration.cc.

637 {
638 UIDartState* dart_state = UIDartState::Current();
639 FML_DCHECK(dart_state && !dart_state->IsRootIsolate());
640 auto platform_message_handler =
641 (*static_cast<std::shared_ptr<PlatformMessageHandlerStorage>*>(
643 FML_DCHECK(platform_message_handler);
644 auto weak_platform_message_handler =
645 platform_message_handler->GetPlatformMessageHandler(root_isolate_token);
646 dart_state->SetPlatformMessageHandler(weak_platform_message_handler);
647}
DART_EXPORT void * Dart_CurrentIsolateGroupData(void)

◆ Render()

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

Definition at line 458 of file platform_configuration.cc.

461 {
464 view_id, scene, width, height);
465}
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.
int32_t height
int32_t 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 568 of file platform_configuration.cc.

568 {
570 current_performance_mode_ = static_cast<Dart_PerformanceMode>(mode);
571 return Dart_SetPerformanceMode(current_performance_mode_);
572}
Dart_PerformanceMode
Definition dart_api.h:1368
DART_EXPORT Dart_PerformanceMode Dart_SetPerformanceMode(Dart_PerformanceMode mode)
it will be possible to load the file into Perfetto s trace viewer 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
Definition switches.h:228

◆ RespondToPlatformMessage()

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

Definition at line 537 of file platform_configuration.cc.

539 {
540 if (Dart_IsNull(data.dart_handle())) {
544 } else {
545 // TODO(engine): Avoid this copy.
546 const uint8_t* buffer = static_cast<const uint8_t*>(data.data());
550 response_id,
551 std::vector<uint8_t>(buffer, buffer + data.length_in_bytes()));
552 }
553}
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.
DART_EXPORT bool Dart_IsNull(Dart_Handle object)
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 switches.h:41
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 vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition switches.h:126

◆ ScheduleFrame()

void flutter::PlatformConfigurationNativeApi::ScheduleFrame ( )
static

Definition at line 590 of file platform_configuration.cc.

590 {
593}
virtual void ScheduleFrame()=0
Requests that, at the next appropriate opportunity, a new frame be scheduled for rendering.

◆ SendChannelUpdate()

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

Definition at line 649 of file platform_configuration.cc.

650 {
652 name, listening);
653}
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 switches.h:32

◆ SendPlatformMessage()

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

Definition at line 494 of file platform_configuration.cc.

497 {
498 UIDartState* dart_state = UIDartState::Current();
499
500 if (!dart_state->platform_configuration()) {
501 return tonic::ToDart(
502 "SendPlatformMessage only works on the root isolate, see "
503 "SendPortPlatformMessage.");
504 }
505
507 if (!Dart_IsNull(callback)) {
508 response = fml::MakeRefCounted<PlatformMessageResponseDart>(
510 dart_state->GetTaskRunners().GetUITaskRunner(), name);
511 }
512
513 return HandlePlatformMessage(dart_state, name, data_handle, response);
514}
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Dart_Handle ToDart(const T &object)

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

520 {
521 // This can be executed on any isolate.
522 UIDartState* dart_state = UIDartState::Current();
523
524 int64_t c_send_port = tonic::DartConverter<int64_t>::FromDart(send_port);
525 if (c_send_port == ILLEGAL_PORT) {
526 return tonic::ToDart("Invalid port specified");
527 }
528
530 fml::MakeRefCounted<PlatformMessageResponseDartPort>(
532 name);
533
534 return HandlePlatformMessage(dart_state, name, data_handle, response);
535}
static SkString identifier(const FontFamilyDesc &family, const FontDesc &font)
#define ILLEGAL_PORT
Definition dart_api.h:1530

◆ SetIsolateDebugName()

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

Definition at line 555 of file platform_configuration.cc.

◆ SetNeedsReportTimings()

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

Definition at line 467 of file platform_configuration.cc.

467 {
471 ->client()
472 ->SetNeedsReportTimings(value);
473}
virtual void SetNeedsReportTimings(bool value)=0
Notifies this client that the application has an opinion about whether its frame timings need to be r...

◆ UpdateSemantics()

void flutter::PlatformConfigurationNativeApi::UpdateSemantics ( SemanticsUpdate update)
static

Definition at line 600 of file platform_configuration.cc.

600 {
603 update);
604}
virtual void UpdateSemantics(SemanticsUpdate *update)=0
Receives an updated semantics tree from the Framework.

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