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

#include <platform_message_response_dart.h>

Inheritance diagram for flutter::PlatformMessageResponseDart:
flutter::PlatformMessageResponse fml::RefCountedThreadSafe< PlatformMessageResponse > fml::internal::RefCountedThreadSafeBase

Public Member Functions

void Complete (std::unique_ptr< fml::Mapping > data) override
 
void CompleteEmpty () override
 
- Public Member Functions inherited from flutter::PlatformMessageResponse
bool is_complete () const
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< PlatformMessageResponse >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 

Protected Member Functions

 PlatformMessageResponseDart (tonic::DartPersistentValue callback, fml::RefPtr< fml::TaskRunner > ui_task_runner, const std::string &channel)
 
 ~PlatformMessageResponseDart () override
 
- Protected Member Functions inherited from flutter::PlatformMessageResponse
 PlatformMessageResponse ()
 
virtual ~PlatformMessageResponse ()
 
- Protected Member Functions inherited from fml::RefCountedThreadSafe< PlatformMessageResponse >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 

Protected Attributes

tonic::DartPersistentValue callback_
 
fml::RefPtr< fml::TaskRunnerui_task_runner_
 
const std::string channel_
 
- Protected Attributes inherited from flutter::PlatformMessageResponse
bool is_complete_ = false
 

Detailed Description

Definition at line 14 of file platform_message_response_dart.h.

Constructor & Destructor Documentation

◆ PlatformMessageResponseDart()

flutter::PlatformMessageResponseDart::PlatformMessageResponseDart ( tonic::DartPersistentValue  callback,
fml::RefPtr< fml::TaskRunner ui_task_runner,
const std::string &  channel 
)
explicitprotected

Definition at line 55 of file platform_message_response_dart.cc.

59 : callback_(std::move(callback)),
60 ui_task_runner_(std::move(ui_task_runner)),
const gchar * channel
FlutterDesktopBinaryReply callback

◆ ~PlatformMessageResponseDart()

flutter::PlatformMessageResponseDart::~PlatformMessageResponseDart ( )
overrideprotected

Definition at line 63 of file platform_message_response_dart.cc.

63 {
64 if (!callback_.is_empty()) {
66 [callback = std::move(callback_)]() mutable { callback.Clear(); }));
67 }
68}
virtual void PostTask(const fml::closure &task) override
internal::CopyableLambda< T > MakeCopyable(T lambda)

References callback, callback_, tonic::DartPersistentValue::is_empty(), fml::MakeCopyable(), fml::TaskRunner::PostTask(), and ui_task_runner_.

Member Function Documentation

◆ Complete()

void flutter::PlatformMessageResponseDart::Complete ( std::unique_ptr< fml::Mapping data)
overridevirtual

Implements flutter::PlatformMessageResponse.

Definition at line 70 of file platform_message_response_dart.cc.

70 {
71 PostCompletion(
73 [data = std::move(data)]() mutable {
74 Dart_Handle byte_buffer;
75 intptr_t size = data->GetSize();
77 const void* mapping = data->GetMapping();
78 byte_buffer = Dart_NewUnmodifiableExternalTypedDataWithFinalizer(
79 /*type=*/Dart_TypedData_kByteData,
80 /*data=*/mapping,
81 /*length=*/size,
82 /*peer=*/data.release(),
83 /*external_allocation_size=*/size,
84 /*callback=*/MappingFinalizer);
85 } else {
86 Dart_Handle mutable_byte_buffer =
87 tonic::DartByteData::Create(data->GetMapping(), data->GetSize());
88 Dart_Handle ui_lib = Dart_LookupLibrary(
89 tonic::DartConverter<std::string>().ToDart("dart:ui"));
90 FML_DCHECK(!(Dart_IsNull(ui_lib) || Dart_IsError(ui_lib)));
91 byte_buffer = Dart_Invoke(ui_lib,
92 tonic::DartConverter<std::string>().ToDart(
93 "_wrapUnmodifiableByteData"),
94 1, &mutable_byte_buffer);
95 FML_DCHECK(!(Dart_IsNull(byte_buffer) || Dart_IsError(byte_buffer)));
96 }
97
98 return byte_buffer;
99 });
100}
static const size_t kExternalSizeThreshold
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 keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
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

References callback_, channel_, flutter::data, flutter::PlatformMessageResponse::is_complete_, tonic::DartByteData::kExternalSizeThreshold, flutter::size, and ui_task_runner_.

◆ CompleteEmpty()

void flutter::PlatformMessageResponseDart::CompleteEmpty ( )
overridevirtual

Implements flutter::PlatformMessageResponse.

Definition at line 102 of file platform_message_response_dart.cc.

102 {
103 PostCompletion(std::move(callback_), ui_task_runner_, &is_complete_, channel_,
104 [] { return Dart_Null(); });
105}

References callback_, channel_, flutter::PlatformMessageResponse::is_complete_, and ui_task_runner_.

Member Data Documentation

◆ callback_

tonic::DartPersistentValue flutter::PlatformMessageResponseDart::callback_
protected

◆ channel_

const std::string flutter::PlatformMessageResponseDart::channel_
protected

Definition at line 31 of file platform_message_response_dart.h.

Referenced by Complete(), and CompleteEmpty().

◆ ui_task_runner_

fml::RefPtr<fml::TaskRunner> flutter::PlatformMessageResponseDart::ui_task_runner_
protected

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