20#define RETURN_IF_ERROR(handle) \
22 Dart_Handle __handle = handle; \
23 if (Dart_IsError((__handle))) { \
47 {0x23, 0x40, 0x64, 0x69, 0x6c, 0x6c, 0x0a}};
51#if defined(DART_HOST_OS_WINDOWS)
66 return dart_arguments;
68 for (
int i = 0;
i < count_;
i++) {
71 return argument_value;
78 return dart_arguments;
109 return static_cast<intptr_t
>(
value);
120 if (!valid)
return false;
129 const char* cstring =
nullptr;
172 return static_cast<intptr_t
>(
value);
183 if (tmp !=
nullptr) {
186 const char* cstring =
nullptr;
191 ASSERT(cstring !=
nullptr);
200 return data.GetScopedCString();
216 static const intptr_t kDartSchemeLen = strlen(
kDartScheme);
219 return (strncmp(url_name,
kDartScheme, kDartSchemeLen) == 0);
223 static const intptr_t kHttpSchemeLen = strlen(
kHttpScheme);
224 return (strncmp(url_name,
kHttpScheme, kHttpSchemeLen) == 0);
228 return (strcmp(url_name,
kIOLibURL) == 0);
244 const char* colon = strchr(url,
':');
245 if (colon ==
nullptr) {
254 if (slash ==
nullptr) {
264 return reinterpret_cast<void*
>(
file);
270 return reinterpret_cast<void*
>(
file);
278 int64_t file_len = file_stream->
Length();
279 if ((file_len < 0) || (file_len >
kIntptrMax)) {
284 *
len =
static_cast<intptr_t
>(file_len);
315 const int kNumArgs = 1;
323#define SET_ERROR_MSG(error_msg, format, ...) \
324 intptr_t len = snprintf(nullptr, 0, format, __VA_ARGS__); \
325 char* msg = reinterpret_cast<char*>(malloc(len + 1)); \
326 snprintf(msg, len + 1, format, __VA_ARGS__); \
331 const char** error_msg) {
335 SET_ERROR_MSG(error_msg,
"Unable to open file: %s", filename);
338 uint8_t* text_buffer =
nullptr;
340 if (text_buffer ==
nullptr || *file_len == -1) {
341 *error_msg =
"Unable to read file contents";
342 text_buffer =
nullptr;
349 const char* error_msg =
nullptr;
352 if (text_buffer ==
nullptr) {
372 ASSERT(td_data !=
nullptr);
373 memmove(td_data,
buffer, td_len);
387 const int kNumArgs = 1;
391 NewString(
"_resolveScriptUri"), kNumArgs, dart_args);
395 intptr_t buffer_length,
397 if ((buffer_length >= magic_number.
length)) {
419 if (
file !=
nullptr) {
431 intptr_t buffer_length) {
489 bool is_service_isolate,
490 bool trace_loading) {
499 if (!is_service_isolate) {
510 result = SetWorkingDirectory();
518 bool is_service_isolate) {
519 if (!is_service_isolate) {
538 args[0] = schedule_immediate_closure;
558 if (packages_config !=
nullptr) {
561 const int kNumArgs = 1;
565 NewString(
"_setPackagesMap"), kNumArgs, dart_args);
571 bool trace_loading) {
605 result = PrepareBuiltinLibrary(builtin_lib, internal_lib, is_service_isolate,
610 RETURN_IF_ERROR(PrepareCoreLibrary(core_lib, io_lib, is_service_isolate));
618 const char* script_uri,
625 if (namespc_path !=
nullptr) {
661 NewString(
"_registerServiceExtension"), 0,
nullptr);
674 int32_t
min = 0xc0000000;
675 int32_t
max = 0x3fffffff;
679 object.value.as_int32 =
value;
687 object.value.as_int64 =
value;
719 const char* exception_name,
732 const char* exception_name,
767 va_list measure_args;
794 va_list measure_args;
795 va_copy(measure_args,
args);
804 va_copy(print_args,
args);
844 char* name_chars =
reinterpret_cast<char*
>(
malloc(utf8_len + 1));
845 memmove(name_chars, utf8_array, utf8_len);
846 name_chars[utf8_len] =
'\0';
847 const char*
value =
nullptr;
848 if (environment_ !=
nullptr) {
852 if (entry !=
nullptr) {
853 value =
reinterpret_cast<char*
>(entry->
value);
856 if (
value !=
nullptr) {
892 return value ? &true_ : &false_;
928 intptr_t
length = strlen(str);
930 char* payload =
reinterpret_cast<char*
>(cobject + 1);
931 memmove(payload, str,
length + 1);
947 memmove(
reinterpret_cast<uint8_t*
>(cobject + 1),
data,
length);
951 reinterpret_cast<const uint8_t*
>(cobject + 1);
986 if (
data ==
nullptr) {
994 if (cobject ==
nullptr)
return;
1001 ASSERT(0 <= new_length && new_length <= old_length);
1006 const auto free_memory = old_length - new_length;
1007 if ((old_length >> 2) <= free_memory && 100 <= free_memory) {
1009 if (new_data !=
nullptr) {
1049 result->SetAt(2, error_message);
Entry * Lookup(void *key, uint32_t hash, bool insert)
static uint32_t StringHash(const char *key)
static char * StrDup(const char *s)
static int static int VSNPrint(char *str, size_t size, const char *format, va_list args)
static char * StrNDup(const char *s, intptr_t n)
static Dart_Handle LoadAndCheckLibrary(BuiltinLibraryId id)
static void SetNativeResolver(BuiltinLibraryId id)
static Dart_CObject * NewString(const char *str)
static CObject * IllegalArgumentError()
static CObject * FileClosedError()
static Dart_CObject * NewExternalUint8Array(intptr_t length, uint8_t *data, void *peer, Dart_HandleFinalizer callback)
static void FreeIOBufferData(Dart_CObject *object)
static Dart_CObject * NewIntptr(intptr_t value)
static constexpr int kOSError
static constexpr int kFileClosedError
static Dart_CObject * NewIOBuffer(int64_t length)
static CObject * Bool(bool value)
static Dart_CObject * NewArray(intptr_t length)
static Dart_CObject * NewUint8Array(const void *data, intptr_t length)
static constexpr int kArgumentError
static Dart_CObject * NewNativePointer(intptr_t ptr, intptr_t size, Dart_HandleFinalizer callback)
static Dart_CObject * NewInt32(int32_t value)
static Dart_CObject * NewInt64(int64_t value)
static Dart_CObject * NewDouble(double value)
static CObject * NewOSError()
static void ShrinkIOBuffer(Dart_CObject *cobject, int64_t new_length)
Dart_Handle CreateRuntimeOptions()
const char * GetArgument(int index) const
static bool GetRandomBytes(intptr_t count, uint8_t *buffer)
static constexpr const char * kDartScheme
static constexpr const char * kCLILibURL
static int64_t GetNativeIntegerArgument(Dart_NativeArguments args, intptr_t index)
static Dart_Handle NewDartFormatException(const char *message)
static char static char * ScopedCStringVFormatted(const char *format, va_list args)
static int64_t GetIntegerValue(Dart_Handle value_obj)
static Dart_Handle SetupPackageConfig(const char *packages_file)
static int64_t GetInt64ValueCheckRange(Dart_Handle value_obj, int64_t lower, int64_t upper)
static Dart_Handle NewDartExceptionWithMessage(const char *library_url, const char *exception_name, const char *message)
static Dart_Handle LookupBuiltinLib()
static constexpr const char * kIOLibURL
static const char * GetNativeTypedDataArgument(Dart_NativeArguments args, intptr_t index)
static Dart_Handle NewDartOSError()
static constexpr const char * kAsyncLibURL
static constexpr const char * kIsolateLibURL
static char * DirName(const char *url)
static void ReadFile(uint8_t **data, intptr_t *file_len, void *stream)
static Dart_Handle ReadStringFromFile(const char *filename)
static bool GetBooleanValue(Dart_Handle bool_obj)
static bool GetInt64Value(Dart_Handle value_obj, int64_t *value)
static bool IsHttpSchemeURL(const char *url_name)
static const char * GetStringValue(Dart_Handle str_obj)
static void * OpenFileUri(const char *uri, bool write)
static Dart_Handle NewDartExceptionWithOSError(const char *library_url, const char *exception_name, const char *message, Dart_Handle os_error)
static Dart_Handle MakeUint8Array(const void *buffer, intptr_t length)
static bool IsDartBuiltinLibURL(const char *url_name)
static constexpr const char * kInternalLibURL
static Dart_Handle SetupIOLibrary(const char *namespc_path, const char *script_uri, bool disable_exit)
static bool PostInt32(Dart_Port port_id, int32_t value)
static Dart_Handle NewStringFormatted(const char *format,...)
static const char * original_working_directory
static bool SetOriginalWorkingDirectory()
static bool PostNull(Dart_Port port_id)
static Dart_Handle NewError(const char *format,...)
static char * ScopedCStringFormatted(const char *format,...) PRINTF_ATTRIBUTE(1
static bool EntropySource(uint8_t *buffer, intptr_t length)
static Dart_Handle EnvironmentCallback(Dart_Handle name)
static Dart_Handle NewDartIOException(const char *exception_name, const char *message, Dart_Handle os_error)
static bool PostString(Dart_Port port_id, const char *value)
static constexpr const char * kHttpLibURL
static constexpr const char * kCoreLibURL
static bool PostInt64(Dart_Port port_id, int64_t value)
static Dart_Handle NewDartUnsupportedError(const char *message)
static intptr_t GetNativeIntptrArgument(Dart_NativeArguments args, intptr_t index)
static char * ScopedCString(intptr_t length)
static Dart_Handle NewString(const char *str)
static Dart_Handle PrepareForScriptLoading(bool is_service_isolate, bool trace_loading)
static void SetEnvironment(dart::SimpleHashMap *environment)
static Dart_Handle SetIntegerField(Dart_Handle handle, const char *name, int64_t val)
static void CloseFile(void *stream)
static Dart_Handle NewDartArgumentError(const char *message)
static MagicNumber SniffForMagicNumber(const char *filename)
static void * OpenFile(const char *name, bool write)
static Dart_Handle NewInternalError(const char *message)
static const char * RemoveScheme(const char *url)
static bool IsDartCLILibURL(const char *url_name)
static constexpr const char * kBuiltinLibURL
static bool IsDartSchemeURL(const char *url_name)
static Dart_Handle SetStringField(Dart_Handle handle, const char *name, const char *val)
static bool IsDartHttpLibURL(const char *url_name)
static constexpr int64_t kMaxMagicNumberSize
static Dart_Handle ResolveScript(Dart_Handle url)
static bool IsDartIOLibURL(const char *url_name)
static Dart_Handle GetDartType(const char *library_url, const char *class_name)
static intptr_t GetIntptrValue(Dart_Handle value_obj)
static constexpr const char * kHttpScheme
static const char * GetNativeStringArgument(Dart_NativeArguments args, intptr_t index)
static void WriteFile(const void *buffer, intptr_t num_bytes, void *stream)
static bool GetNativeBooleanArgument(Dart_NativeArguments args, intptr_t index)
@ kAotCoffARM64MagicNumber
@ kAotMachO64Arm64MagicNumber
@ kAotCoffRISCV64MagicNumber
@ kAotCoffARM32MagicNumber
@ kAotCoffRISCV32MagicNumber
static char * CurrentNoScope()
static File * OpenUri(Namespace *namespc, const char *uri, FileOpenMode mode)
static const char * PathSeparator()
bool WriteFully(const void *buffer, int64_t num_bytes)
bool ReadFully(void *buffer, int64_t num_bytes)
static File * Open(Namespace *namespc, const char *path, FileOpenMode mode)
static Type GetType(Namespace *namespc, const char *path, bool follow_links)
static void Finalizer(void *isolate_callback_data, void *buffer)
static Dart_Handle Allocate(intptr_t size, uint8_t **buffer)
static uint8_t * Reallocate(uint8_t *buffer, intptr_t new_size)
struct _Dart_Handle * Dart_Handle
void(* Dart_HandleFinalizer)(void *isolate_callback_data, void *peer)
struct _Dart_NativeArguments * Dart_NativeArguments
@ Dart_CObject_kNativePointer
@ Dart_CObject_kTypedData
@ Dart_CObject_kExternalTypedData
#define SET_ERROR_MSG(error_msg, format,...)
#define RETURN_IF_ERROR(handle)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
uint32_t uint32_t * format
static float max(float r, float g, float b)
static float min(float r, float g, float b)
MagicNumberData gzip_magic_number
MagicNumberData aotcoff_riscv32_magic_number
MagicNumberData appjit_magic_number
static void * GetHashmapKeyFromString(char *key)
MagicNumberData aotmacho32_magic_number
static uint8_t * ReadFileFully(const char *filename, intptr_t *file_len, const char **error_msg)
CObject CObject::false_ & api_false_
MagicNumberData aotmacho64_magic_number
static Dart_Handle SingleArgDart_Invoke(Dart_Handle lib, const char *method, Dart_Handle arg)
MagicNumberData kernel_list_magic_number
MagicNumberData aotelf_magic_number
CObject CObject::true_ & api_true_
static bool CheckMagicNumber(const uint8_t *buffer, intptr_t buffer_length, const MagicNumberData &magic_number)
MagicNumberData aotcoff_riscv64_magic_number
CObject CObject::null_ & api_null_
MagicNumberData kernel_magic_number
static bool IsWindowsHost()
MagicNumberData aotcoff_arm64_magic_number
MagicNumberData aotcoff_arm32_magic_number
MagicNumberData aotmacho64_arm64_magic_number
static dart::SimpleHashMap * environment
DART_EXPORT Dart_Handle Dart_StringToUTF8(Dart_Handle str, uint8_t **utf8_array, intptr_t *length)
DART_EXPORT Dart_Handle Dart_GetNativeStringArgument(Dart_NativeArguments args, int arg_index, void **peer)
DART_EXPORT Dart_Handle Dart_FinalizeLoading(bool complete_futures)
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()
void * malloc(size_t size)
const char *const class_name
constexpr intptr_t kIntptrMin
DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value)
DART_EXPORT Dart_Handle Dart_BooleanValue(Dart_Handle boolean_obj, bool *value)
DART_EXPORT Dart_Handle Dart_NewStringFromUTF8(const uint8_t *utf8_array, intptr_t length)
DART_EXPORT void Dart_PropagateError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_GetNonNullableType(Dart_Handle library, Dart_Handle class_name, intptr_t number_of_type_arguments, Dart_Handle *type_arguments)
DART_EXPORT const char * Dart_GetError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_NewTypedData(Dart_TypedData_Type type, intptr_t length)
DART_EXPORT uint8_t * Dart_ScopeAllocate(intptr_t size)
DART_EXPORT Dart_Handle Dart_TypedDataAcquireData(Dart_Handle object, Dart_TypedData_Type *type, void **data, intptr_t *len)
DART_EXPORT Dart_Handle Dart_NewListOfTypeFilled(Dart_Handle element_type, Dart_Handle fill_object, intptr_t length)
DART_EXPORT Dart_Handle Dart_ListSetAt(Dart_Handle list, intptr_t index, Dart_Handle value)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT Dart_Handle Dart_EmptyString()
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
DART_EXPORT Dart_Handle Dart_SetField(Dart_Handle container, Dart_Handle name, Dart_Handle value)
DART_EXPORT Dart_Handle Dart_TypedDataReleaseData(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_IntegerFitsIntoInt64(Dart_Handle integer, bool *fits)
DART_EXPORT Dart_Handle Dart_NewApiError(const char *error)
DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url)
DART_EXPORT Dart_Handle Dart_ThrowException(Dart_Handle exception)
DART_EXPORT Dart_Handle Dart_GetNativeIntegerArgument(Dart_NativeArguments args, int index, int64_t *value)
DART_EXPORT bool Dart_IsInteger(Dart_Handle object)
DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject *message)
DART_EXPORT Dart_Handle Dart_Null()
DART_EXPORT Dart_Handle Dart_New(Dart_Handle type, Dart_Handle constructor_name, int number_of_arguments, Dart_Handle *arguments)
static int8_t data[kExtLength]
DART_EXPORT Dart_Handle Dart_GetNativeBooleanArgument(Dart_NativeArguments args, int index, bool *value)
DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle object, const char **cstr)
constexpr intptr_t kIntptrMax
DART_EXPORT Dart_Handle Dart_IntegerToInt64(Dart_Handle integer, int64_t *value)
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
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
def print(*args, **kwargs)
static const char header[]
void write(SkWStream *wStream, const T &text)
Dart_HandleFinalizer callback
union _Dart_CObject::@86 value
struct _Dart_CObject::@86::@90 as_typed_data
struct _Dart_CObject::@86::@91 as_external_typed_data
struct _Dart_CObject::@86::@89 as_array
struct _Dart_CObject ** values
struct _Dart_CObject::@86::@92 as_native_pointer
const uint8_t bytes[kMaxLength]