Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
flutter::PlatformMessageResponseDartPort Class Reference

A PlatformMessageResponse that will respond over a Dart port. More...

#include <platform_message_response_dart_port.h>

Inheritance diagram for flutter::PlatformMessageResponseDartPort:
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

 PlatformMessageResponseDartPort (Dart_Port send_port, int64_t identifier, const std::string &channel)
 
- 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

Dart_Port send_port_
 
int64_t identifier_
 
const std::string channel_
 
- Protected Attributes inherited from flutter::PlatformMessageResponse
bool is_complete_ = false
 

Detailed Description

A PlatformMessageResponse that will respond over a Dart port.

Definition at line 15 of file platform_message_response_dart_port.h.

Constructor & Destructor Documentation

◆ PlatformMessageResponseDartPort()

flutter::PlatformMessageResponseDartPort::PlatformMessageResponseDartPort ( Dart_Port  send_port,
int64_t  identifier,
const std::string &  channel 
)
explicitprotected

Definition at line 21 of file platform_message_response_dart_port.cc.

25 : send_port_(send_port), identifier_(identifier), channel_(channel) {
26 FML_DCHECK(send_port != ILLEGAL_PORT);
27}
static SkString identifier(const FontFamilyDesc &family, const FontDesc &font)
#define ILLEGAL_PORT
Definition: dart_api.h:1535
#define FML_DCHECK(condition)
Definition: logging.h:103

Member Function Documentation

◆ Complete()

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

Implements flutter::PlatformMessageResponse.

Definition at line 29 of file platform_message_response_dart_port.cc.

30 {
31 is_complete_ = true;
32 Dart_CObject response_identifier = {
34 };
35 response_identifier.value.as_int64 = identifier_;
36 Dart_CObject response_data = {
38 };
40 response_data.value.as_typed_data.length = data->GetSize();
41 response_data.value.as_typed_data.values = data->GetMapping();
42
43 std::array<Dart_CObject*, 2> response_values = {&response_identifier,
44 &response_data};
45
46 Dart_CObject response = {
48 };
49 response.value.as_array.length = response_values.size();
50 response.value.as_array.values = response_values.data();
51
52 bool did_send = Dart_PostCObject(send_port_, &response);
53 FML_CHECK(did_send);
54}
@ Dart_TypedData_kUint8
Definition: dart_api.h:2615
@ Dart_CObject_kInt64
@ Dart_CObject_kTypedData
@ Dart_CObject_kArray
DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject *message)
#define FML_CHECK(condition)
Definition: logging.h:85
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
union _Dart_CObject::@86 value
Dart_CObject_Type type
uint8_t * data
struct _Dart_CObject::@86::@90 as_typed_data
struct _Dart_CObject::@86::@89 as_array
struct _Dart_CObject ** values

◆ CompleteEmpty()

void flutter::PlatformMessageResponseDartPort::CompleteEmpty ( )
overridevirtual

Implements flutter::PlatformMessageResponse.

Definition at line 56 of file platform_message_response_dart_port.cc.

56 {
57 is_complete_ = true;
58 Dart_CObject response = {
60 };
61 bool did_send = Dart_PostCObject(send_port_, &response);
62 FML_CHECK(did_send);
63}
@ Dart_CObject_kNull

Member Data Documentation

◆ channel_

const std::string flutter::PlatformMessageResponseDartPort::channel_
protected

Definition at line 30 of file platform_message_response_dart_port.h.

◆ identifier_

int64_t flutter::PlatformMessageResponseDartPort::identifier_
protected

Definition at line 29 of file platform_message_response_dart_port.h.

◆ send_port_

Dart_Port flutter::PlatformMessageResponseDartPort::send_port_
protected

Definition at line 28 of file platform_message_response_dart_port.h.


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