5#ifndef RUNTIME_BIN_DARTUTILS_H_
6#define RUNTIME_BIN_DARTUTILS_H_
39 return reinterpret_cast<void*
>(
key);
45 : count_(0), max_count_(
max_count), arguments_(nullptr) {
48 if (arguments_ ==
nullptr) {
61 int count()
const {
return count_; }
63 const char**
arguments()
const {
return arguments_; }
66 return (index >= 0 && index < count_) ? arguments_[index] :
nullptr;
69 if (count_ < max_count_) {
70 arguments_[count_] = argument;
78 if (count_ + argc >= max_count_) {
81 for (
int i = 0;
i < argc; ++
i) {
82 arguments_[count_++] =
argv[
i];
89 void DebugPrint()
const {
96 void operator delete(
void* pointer) { abort(); }
99 void*
operator new(
size_t size);
103 const char** arguments_;
170 static char*
DirName(
const char* url);
185 const char* script_uri,
200 const char* exception_name,
204 const char* exception_name,
233 size_t str_len = strlen(str);
235 memmove(
result, str, str_len);
285 intptr_t buffer_len);
312 bool is_service_isolate,
316 bool is_service_isolate);
325 DISALLOW_ALLOCATION();
326 DISALLOW_IMPLICIT_CONSTRUCTORS(
DartUtils);
420 DISALLOW_COPY_AND_ASSIGN(
CObject);
423#define DECLARE_COBJECT_CONSTRUCTORS(t) \
424 explicit CObject##t(Dart_CObject* cobject) : CObject(cobject) { \
425 ASSERT(type() == Dart_CObject_k##t); \
426 cobject_ = cobject; \
428 explicit CObject##t(CObject* cobject) : CObject() { \
429 ASSERT(cobject != nullptr); \
430 ASSERT(cobject->type() == Dart_CObject_k##t); \
431 cobject_ = cobject->AsApiCObject(); \
434#define DECLARE_COBJECT_TYPED_DATA_CONSTRUCTORS(t) \
435 explicit CObject##t##Array(Dart_CObject* cobject) : CObject(cobject) { \
436 ASSERT(type() == Dart_CObject_kTypedData); \
437 ASSERT(byte_array_type() == Dart_TypedData_k##t); \
438 cobject_ = cobject; \
440 explicit CObject##t##Array(CObject* cobject) : CObject() { \
441 ASSERT(cobject != nullptr); \
442 ASSERT(cobject->type() == Dart_CObject_kTypedData); \
443 ASSERT(cobject->byte_array_type() == Dart_TypedData_k##t); \
444 cobject_ = cobject->AsApiCObject(); \
447#define DECLARE_COBJECT_EXTERNAL_TYPED_DATA_CONSTRUCTORS(t) \
448 explicit CObjectExternal##t##Array(Dart_CObject* cobject) \
449 : CObject(cobject) { \
450 ASSERT(type() == Dart_CObject_kExternalTypedData); \
451 ASSERT(byte_array_type() == Dart_TypedData_k##t); \
452 cobject_ = cobject; \
454 explicit CObjectExternal##t##Array(CObject* cobject) : CObject() { \
455 ASSERT(cobject != nullptr); \
456 ASSERT(cobject->type() == Dart_CObject_kExternalTypedData); \
457 ASSERT(cobject->byte_array_type() == Dart_TypedData_k##t); \
458 cobject_ = cobject->AsApiCObject(); \
498 ASSERT(cobject !=
nullptr);
574 ASSERT(cobject !=
nullptr);
649 DISALLOW_ALLOCATION();
static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
void SetAt(intptr_t index, CObject *value)
CObject * operator[](intptr_t index) const
Dart_HandleFinalizer Callback() const
CObjectIntptr(CObject *cobject)
CObjectIntptr(Dart_CObject *cobject)
Dart_HandleFinalizer Callback() const
Dart_Port OriginId() const
const char * CString() const
const uint8_t * Buffer() const
Dart_TypedData_Type Type() const
CObjectTypedData(Dart_CObject *cobject)
CObjectTypedData(CObject *cobject)
const uint8_t * Buffer() const
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)
Dart_CObject * AsApiCObject()
static Dart_CObject * NewArray(intptr_t length)
Dart_TypedData_Type byte_array_type()
static Dart_CObject * NewUint8Array(const void *data, intptr_t length)
static constexpr int kSuccess
static constexpr int kArgumentError
CObject(Dart_CObject *cobject)
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)
const char ** arguments() const
void AddArguments(const char **argv, int argc)
void AddArgument(const char *argument)
CommandLineOptions(int max_count)
Dart_Handle CreateRuntimeOptions()
const char * GetArgument(int index) const
static constexpr const char * kDartScheme
static constexpr const char * kCLILibURL
static constexpr const char * kCLILibPatchURL
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 constexpr const char * kVMServiceLibURL
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 void * MapExecutable(const char *name, intptr_t *file_len)
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 constexpr const char * kIOLibPatchURL
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 char * ScopedCopyCString(const char *str)
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 bool IsAotMagicNumber(MagicNumber number)
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 constexpr const char * kUriLibURL
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
struct _Dart_Handle * Dart_Handle
void(* Dart_HandleFinalizer)(void *isolate_callback_data, void *peer)
struct _Dart_NativeArguments * Dart_NativeArguments
@ Dart_CObject_kTypedData
@ Dart_CObject_kExternalTypedData
#define DECLARE_COBJECT_TYPED_DATA_CONSTRUCTORS(t)
#define DECLARE_COBJECT_CONSTRUCTORS(t)
#define DECLARE_COBJECT_EXTERNAL_TYPED_DATA_CONSTRUCTORS(t)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
uint32_t uint32_t * format
MagicNumberData gzip_magic_number
MagicNumberData appjit_magic_number
static Dart_Handle ThrowIfError(Dart_Handle handle)
static void * GetHashmapKeyFromString(char *key)
MagicNumberData kernel_list_magic_number
MagicNumberData aotelf_magic_number
MagicNumberData kernel_magic_number
PRINTF_ATTRIBUTE(1, 2) static void PrintErrAndExit(const char *format
static dart::SimpleHashMap * environment
DART_EXPORT void Dart_ThreadEnableProfiling()
void * malloc(size_t size)
const char *const class_name
DART_EXPORT Dart_Handle Dart_NewStringFromUTF8(const uint8_t *utf8_array, intptr_t length)
DART_EXPORT void Dart_PropagateError(Dart_Handle handle)
DART_EXPORT uint8_t * Dart_ScopeAllocate(intptr_t size)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT void Dart_ThreadDisableProfiling()
constexpr intptr_t kWordSize
DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url)
static int8_t data[kExtLength]
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
void write(SkWStream *wStream, const T &text)
struct _Dart_CObject::@86::@87 as_send_port
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]
static constexpr intptr_t kMaxLength