24#define RETURN_ERROR_HANDLE(handle) \
25 if (Dart_IsError(handle)) { \
29#define SHUTDOWN_ON_ERROR(handle) \
30 if (Dart_IsError(handle)) { \
31 error_msg_ = Utils::StrDup(Dart_GetError(handle)); \
33 Dart_ShutdownIsolate(); \
41 const char* uri_chars;
44 VmService::SetServerAddress(
"");
50 VmService::SetServerAddress(
"");
54 VmService::SetServerAddress(uri_chars);
70 {
"VMServiceIO_Shutdown", 0,
Shutdown},
75 bool* auto_setup_scope) {
80 *auto_setup_scope =
true;
83 for (intptr_t
i = 0;
i < n;
i++) {
96 for (intptr_t
i = 0;
i < n;
i++) {
99 return reinterpret_cast<const uint8_t*
>(entry.
name);
105const char* VmService::error_msg_ =
nullptr;
106char VmService::server_uri_[kServerUriStringBufferSize];
118 intptr_t server_port,
119 bool dev_mode_server,
120 bool auth_codes_disabled,
121 const char* write_service_info_filename,
124 bool enable_service_port_fallback,
125 bool wait_for_dds_to_advertise_service,
127 bool serve_observatory,
130 ASSERT(isolate !=
nullptr);
131 SetServerAddress(
"");
155 if (error_msg_ !=
nullptr) {
168 bool auto_start = server_port >= 0;
169 if (server_port < 0) {
174 if (wait_for_dds_to_advertise_service) {
206 if (write_service_info_filename !=
nullptr) {
208 write_service_info_filename);
230#if defined(DART_HOST_OS_WINDOWS)
240#if defined(DART_HOST_OS_FUCHSIA)
267 return (error_msg_ ==
nullptr) ?
"No error." : error_msg_;
270void VmService::SetServerAddress(
const char* server_uri) {
271 if (server_uri ==
nullptr) {
274 const intptr_t server_uri_len = strlen(server_uri);
275 if (server_uri_len >= (kServerUriStringBufferSize - 1)) {
276 FATAL(
"vm-service: Server URI exceeded length: %s\n", server_uri);
278 strncpy(server_uri_, server_uri, kServerUriStringBufferSize);
279 server_uri_[kServerUriStringBufferSize - 1] =
'\0';
static constexpr const char * kIOLibURL
static Dart_Handle NewString(const char *str)
static Dart_Handle PrepareForScriptLoading(bool is_service_isolate, bool trace_loading)
static Dart_Handle SetIntegerField(Dart_Handle handle, const char *name, int64_t val)
static Dart_Handle SetStringField(Dart_Handle handle, const char *name, const char *val)
static const char * GetErrorMessage()
static void SetNativeResolver()
static bool Setup(const char *server_ip, intptr_t server_port, bool dev_mode_server, bool auth_codes_disabled, const char *write_service_info_filename, bool trace_loading, bool deterministic, bool enable_service_port_fallback, bool wait_for_dds_to_advertise_service, bool serve_devtools, bool serve_observatory, bool print_dtd)
struct _Dart_Handle * Dart_Handle
struct _Dart_Isolate * Dart_Isolate
struct _Dart_NativeArguments * Dart_NativeArguments
void(* Dart_NativeFunction)(Dart_NativeArguments arguments)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
static Dart_NativeFunction VmServiceIONativeResolver(Dart_Handle name, int num_arguments, bool *auto_setup_scope)
static constexpr const char * DEFAULT_VM_SERVICE_SERVER_IP
static void Shutdown(Dart_NativeArguments args)
void NotifyServerState(Dart_NativeArguments args)
const uint8_t * VmServiceIONativeSymbol(Dart_NativeFunction nf)
static VmServiceIONativeEntry _VmServiceIONativeEntries[]
static constexpr const char * kVMServiceIOLibraryUri
DART_EXPORT void Dart_EnterScope()
DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate)
DART_EXPORT Dart_Handle Dart_False()
DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
DART_EXPORT Dart_Handle Dart_True()
DART_EXPORT Dart_Handle Dart_RootLibrary()
DART_EXPORT Dart_Isolate Dart_CurrentIsolate()
DART_EXPORT Dart_Handle Dart_NewBoolean(bool value)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_SetNativeResolver(Dart_Handle library, Dart_NativeEntryResolver resolver, Dart_NativeEntrySymbol symbol)
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
DART_EXPORT void Dart_ExitIsolate()
DART_EXPORT char * Dart_IsolateMakeRunnable(Dart_Isolate isolate)
DART_EXPORT Dart_Handle Dart_SetField(Dart_Handle container, Dart_Handle name, Dart_Handle value)
DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url)
const char *const function_name
DART_EXPORT Dart_Handle Dart_SetRootLibrary(Dart_Handle library)
DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle object, const char **cstr)
DART_EXPORT Dart_Handle Dart_NewStringFromCString(const char *str)
Dart_NativeFunction function
#define SHUTDOWN_ON_ERROR(handle)