Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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
virtual void Complete (std::unique_ptr< fml::Mapping > data)=0
 
virtual void CompleteEmpty ()=0
 
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)),
61 channel_(channel) {}
FlKeyEvent uint64_t FlKeyResponderAsyncCallback 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
Definition: task_runner.cc:24
internal::CopyableLambda< T > MakeCopyable(T lambda)
Definition: make_copyable.h:57

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
struct _Dart_Handle * Dart_Handle
Definition: dart_api.h:258
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
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 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
Definition: switches.h:259

◆ 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}
DART_EXPORT Dart_Handle Dart_Null(void)

Member Data Documentation

◆ callback_

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

Definition at line 29 of file platform_message_response_dart.h.

◆ channel_

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

Definition at line 31 of file platform_message_response_dart.h.

◆ ui_task_runner_

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

Definition at line 30 of file platform_message_response_dart.h.


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