Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
dart::PendingCall Class Reference

Public Member Functions

 PendingCall (void **buffer, size_t *length)
 
 ~PendingCall ()
 
Dart_Port port () const
 
void PostAndWait (Dart_Port port, Dart_CObject *object)
 

Static Public Member Functions

static void HandleResponse (Dart_Port p, Dart_CObject *message)
 

Detailed Description

Definition at line 629 of file ffi_test_functions_vmspecific.cc.

Constructor & Destructor Documentation

◆ PendingCall()

dart::PendingCall::PendingCall ( void **  buffer,
size_t *  length 
)
inline

Definition at line 631 of file ffi_test_functions_vmspecific.cc.

632 : response_buffer_(buffer), response_length_(length) {
633 receive_port_ =
634 Dart_NewNativePort_DL("cpp-response", &PendingCall::HandleResponse,
635 /*handle_concurrently=*/false);
636 }
static void HandleResponse(Dart_Port p, Dart_CObject *message)
size_t length
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

◆ ~PendingCall()

dart::PendingCall::~PendingCall ( )
inline

Definition at line 637 of file ffi_test_functions_vmspecific.cc.

637{ Dart_CloseNativePort_DL(receive_port_); }

Member Function Documentation

◆ HandleResponse()

static void dart::PendingCall::HandleResponse ( Dart_Port  p,
Dart_CObject message 
)
inlinestatic

Definition at line 652 of file ffi_test_functions_vmspecific.cc.

652 {
653 if (message->type != Dart_CObject_kArray) {
654 FATAL("C : Wrong Data: message->type != Dart_CObject_kArray.\n");
655 }
656 Dart_CObject** c_response_args = message->value.as_array.values;
657 Dart_CObject* c_pending_call = c_response_args[0];
658 Dart_CObject* c_message = c_response_args[1];
659 printf("C : HandleResponse (call: %" Px ", message: %" Px ").\n",
660 reinterpret_cast<intptr_t>(c_pending_call),
661 reinterpret_cast<intptr_t>(c_message));
662
663 auto pending_call = reinterpret_cast<PendingCall*>(
664 c_pending_call->type == Dart_CObject_kInt64
665 ? c_pending_call->value.as_int64
666 : c_pending_call->value.as_int32);
667
668 pending_call->ResolveCall(c_message);
669 }
PendingCall(void **buffer, size_t *length)
@ Dart_CObject_kInt64
@ Dart_CObject_kArray
#define FATAL(error)
Win32Message message
std::string printf(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: SkSLString.cpp:83
#define Px
Definition: globals.h:410
union _Dart_CObject::@86 value
Dart_CObject_Type type

◆ port()

Dart_Port dart::PendingCall::port ( ) const
inline

Definition at line 639 of file ffi_test_functions_vmspecific.cc.

639{ return receive_port_; }

◆ PostAndWait()

void dart::PendingCall::PostAndWait ( Dart_Port  port,
Dart_CObject object 
)
inline

Definition at line 641 of file ffi_test_functions_vmspecific.cc.

641 {
642 std::unique_lock<std::mutex> lock(mutex);
643 const bool success = Dart_PostCObject_DL(port, object);
644 if (!success) FATAL("Failed to send message, invalid port or isolate died");
645
646 printf("C : Waiting for result.\n");
647 while (!notified) {
648 cv.wait(lock);
649 }
650 }

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