27 : saved_isolate_(current_isolate) {
28 if (current_isolate !=
nullptr) {
34 if (saved_isolate_ !=
nullptr) {
76 bool handle_concurrently) {
77 if (
name ==
nullptr) {
78 name =
"<UnnamedNativePort>";
80 if (handler ==
nullptr) {
81 OS::PrintErr(
"%s expects argument 'handler' to be non-null.\n",
117 intptr_t request_json_length,
118 uint8_t** response_json,
119 intptr_t* response_json_length,
123 ASSERT(isolate ==
nullptr || !isolate->is_service_isolate());
138 static uint8_t* result_bytes =
nullptr;
139 static intptr_t result_length = 0;
141 ASSERT(result_bytes ==
nullptr);
142 ASSERT(result_length == 0);
151 result_length =
message->value.as_typed_data.length;
152 result_bytes =
reinterpret_cast<uint8_t*
>(
malloc(result_length));
153 memmove(result_bytes,
message->value.as_typed_data.values, result_length);
162 if (
error !=
nullptr) {
179 auto wait_result = monitor.
Wait(1000);
192 *response_json = result_bytes;
193 *response_json_length = result_length;
197 result_bytes =
nullptr;
212 if (
error !=
nullptr) {
222#if defined(DART_PRECOMPILED_RUNTIME)
233 if (!
error.IsNull()) {
241#if defined(DART_PRECOMPILED_RUNTIME)
242 return Api::NewError(
"%s: All classes are already finalized in AOT runtime.",
253 if (!
error.IsNull()) {
266 if (strcmp(
command,
"gc-on-nth-allocation") == 0) {
268 Isolate* isolate = (thread ==
nullptr) ?
nullptr : thread->
isolate();
271 intptr_t argument =
reinterpret_cast<intptr_t
>(arg);
276 }
else if (strcmp(
command,
"gc-now") == 0) {
279 Isolate* isolate = (thread ==
nullptr) ?
nullptr : thread->
isolate();
285 }
else if (strcmp(
command,
"is-thread-in-generated") == 0) {
287 return reinterpret_cast<void*
>(1);
291 }
else if (strcmp(
command,
"is-mutator-in-native") == 0) {
301 }
else if (strcmp(
command,
"run-in-safepoint-and-rw-code") == 0) {
306 auto isolate_group = isolate->
group();
307 const bool kBypassSafepoint =
false;
313 isolate_group->heap()->WriteProtectCode(
false);
315 isolate_group->heap()->WriteProtectCode(
true);
#define RELEASE_ASSERT(cond)
static Dart_Handle Success()
static Dart_Handle NewHandle(Thread *thread, ObjectPtr raw)
static bool IsError(Dart_Handle handle)
static Dart_Handle NewError(const char *format,...) PRINTF_ATTRIBUTE(1
static Dart_Handle CheckAndFinalizePendingClasses(Thread *thread)
static ThreadPool * thread_pool()
static bool IsInitialized()
static bool SetActiveApiCall()
static void ResetActiveApiCall()
void CollectOnNthAllocation(intptr_t num_allocations)
void CollectAllGarbage(GCReason reason=GCReason::kFull, bool compact=false)
static IsolateGroup * Current()
IsolateLeaveScope(Isolate *current_isolate)
static Isolate * Current()
IsolateGroup * group() const
Thread * mutator_thread() const
static ErrorPtr FinalizeAllClasses()
static ErrorPtr CompileAll(bool ignore_error=false)
bool Run(ThreadPool *pool, StartCallback start_callback, EndCallback end_callback, CallbackData data)
static std::unique_ptr< Message > New(Args &&... args)
Monitor::WaitResult Wait(int64_t millis=Monitor::kNoTimeout)
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static bool PostMessage(std::unique_ptr< Message > message, bool before_events=false)
static bool ClosePort(Dart_Port id, MessageHandler **message_handler=nullptr)
static Dart_Port CreatePort(MessageHandler *handler)
static bool SendServiceRpc(uint8_t *request_json, intptr_t request_json_length, Dart_Port reply_port, char **error)
static SmiPtr New(intptr_t value)
static bool IsValid(int64_t value)
NO_SANITIZE_THREAD ExecutionState execution_state_cross_thread_for_testing() const
static Thread * Current()
static void ExitIsolateGroupAsHelper(bool bypass_safepoint)
Isolate * isolate() const
static bool EnterIsolateGroupAsHelper(IsolateGroup *isolate_group, TaskKind kind, bool bypass_safepoint)
static char * StrDup(const char *s)
struct _Dart_Handle * Dart_Handle
struct _Dart_Isolate * Dart_Isolate
#define API_TIMELINE_DURATION(thread)
#define CHECK_ISOLATE(isolate)
#define DARTSCOPE(thread)
#define CHECK_CALLBACK_STATE(thread)
void(* Dart_NativeMessageHandler)(Dart_Port dest_port_id, Dart_CObject *message)
@ Dart_CObject_kTypedData
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
const uint8_t uint32_t uint32_t GError ** error
Dart_NativeFunction function
void HandleResponse(bool handled, void *user_data)
DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate)
void * malloc(size_t size)
DART_EXPORT void * Dart_ExecuteInternalCommand(const char *command, void *arg)
static void HandleResponse(Dart_Port dest_port_id, Dart_CObject *message)
static bool PostCObjectHelper(Dart_Port port_id, Dart_CObject *message)
DART_EXPORT bool Dart_InvokeVMServiceMethod(uint8_t *request_json, intptr_t request_json_length, uint8_t **response_json, intptr_t *response_json_length, char **error)
DART_EXPORT void Dart_ExitIsolate()
DART_EXPORT bool Dart_CloseNativePort(Dart_Port native_port_id)
DART_EXPORT Dart_Handle Dart_CompileAll()
DART_EXPORT Dart_Handle Dart_FinalizeAllClasses()
std::unique_ptr< Message > WriteApiMessage(Zone *zone, Dart_CObject *obj, Dart_Port dest_port, Message::Priority priority)
DART_EXPORT Dart_Port Dart_NewNativePort(const char *name, Dart_NativeMessageHandler handler, bool handle_concurrently)
DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject *message)
DART_EXPORT bool Dart_PostInteger(Dart_Port port_id, int64_t message)
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 port
union _Dart_CObject::@86 value
std::function< void()> * callback