7#include <lib/fdio/namespace.h>
8#include <lib/zx/channel.h>
13#include "flutter/fml/logging.h"
15#include "third_party/dart/runtime/bin/io_natives.h"
16#include "third_party/dart/runtime/include/dart_api.h"
28#define REGISTER_FUNCTION(name, count) {#name, name, count},
29#define DECLARE_FUNCTION(name, count) \
30 extern void name(Dart_NativeArguments args);
32#define BUILTIN_NATIVE_LIST(V) \
33 V(Logger_PrintString, 1) \
34 V(ScheduleMicrotask, 1)
46 bool* auto_setup_scope) {
54 *auto_setup_scope =
true;
56 for (
size_t i = 0;
i < num_entries;
i++) {
60 return entry.function;
68 for (
size_t i = 0;
i < num_entries;
i++) {
70 if (entry.function == native_function)
71 return reinterpret_cast<const uint8_t*
>(entry.name);
78 uint8_t* chars =
nullptr;
84 fwrite(chars, 1,
length, stdout);
103 zx::channel directory_request,
104 bool service_isolate) {
107 if (!service_isolate) {
116 BuiltinNativeSymbol);
147#if !defined(AOT_RUNTIME)
166 if (service_isolate) {
169 isolate_lib,
ToDart(
"_getIsolateScheduleImmediateClosure"), 0,
nullptr);
173 builtin_lib,
ToDart(
"_getScheduleMicrotaskClosure"), 0,
nullptr);
178 schedule_args[0] = schedule_immediate_closure;
189 namespace_args[0] =
ToDart(
reinterpret_cast<intptr_t
>(namespc));
200 ToDart(
reinterpret_cast<intptr_t
>(namespc)));
Dart_NativeFunction function
#define BUILTIN_NATIVE_LIST(V)
#define REGISTER_FUNCTION(name, count)
#define DECLARE_FUNCTION(name, count)
void ScheduleMicrotask(Dart_Handle callback)
static DartMicrotaskQueue * GetForCurrentThread()
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 Dart_Handle Dart_SetNativeResolver(Dart_Handle library, Dart_NativeEntryResolver resolver, Dart_NativeEntrySymbol symbol)
struct _Dart_Handle * Dart_Handle
DART_EXPORT void Dart_PropagateError(Dart_Handle handle)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_Invoke(Dart_Handle target, Dart_Handle name, int number_of_arguments, Dart_Handle *arguments)
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
DART_EXPORT Dart_Handle Dart_LookupLibrary(Dart_Handle url)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_FinalizeLoading(bool complete_futures)
struct _Dart_NativeArguments * Dart_NativeArguments
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_SetField(Dart_Handle container, Dart_Handle name, Dart_Handle value)
DART_EXPORT Dart_Handle Dart_False(void)
DART_EXPORT Dart_Handle Dart_StringToUTF8(Dart_Handle str, uint8_t **utf8_array, intptr_t *length)
DART_EXPORT Dart_Handle Dart_StringToCString(Dart_Handle str, const char **cstr)
void(* Dart_NativeFunction)(Dart_NativeArguments arguments)
DART_EXPORT Dart_Handle Dart_NewInteger(int64_t value)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT bool Dart_IsClosure(Dart_Handle object)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
#define FML_CHECK(condition)
#define FML_DCHECK(condition)
const uint8_t * IONativeSymbol(Dart_NativeFunction nf)
Dart_NativeFunction IONativeLookup(Dart_Handle name, int argument_count, bool *auto_setup_scope)
void InitBuiltinLibrariesForIsolate(const std::string &script_uri, fdio_ns_t *namespc, int stdoutfd, int stderrfd, zx::channel directory_request, bool service_isolate)
size_t ArraySize(T(&array)[SIZE])
const char *const function_name
std::function< void(Dart_NativeArguments)> NativeEntry
std::function< void()> closure
void Initialize(zx::channel directory_request, std::optional< zx::eventpair > view_ref)
Initializes Dart bindings for the Fuchsia application model.
def print(*args, **kwargs)
Dart_Handle ToDart(const T &object)
bool CheckAndHandleError(Dart_Handle handle)