9#include "third_party/dart/runtime/include/dart_api.h"
17 zx::channel directory_request,
18 zx::eventpair view_ref)
19 : fdio_ns_(
std::move(fdio_ns)),
20 directory_request_(
std::move(directory_request)),
21 view_ref_(
std::move(view_ref)) {}
42void IsolateConfigurator::BindFuchsia() {
44 std::move(view_ref_));
47void IsolateConfigurator::BindZircon() {
49 Dart_Handle zircon_lib = Dart_LookupLibrary(
tonic::ToDart(
"dart:zircon"));
52 Dart_Handle namespace_type = Dart_GetNonNullableType(
57 Dart_SetField(namespace_type,
63void IsolateConfigurator::BindDartIO() {
65 Dart_Handle io_lib = Dart_LookupLibrary(
tonic::ToDart(
"dart:io"));
69 Dart_Handle embedder_config_type = Dart_GetNonNullableType(
73 Dart_Handle result = Dart_SetField(embedder_config_type,
78 Dart_Handle namespace_type =
79 Dart_GetNonNullableType(io_lib,
tonic::ToDart(
"_Namespace"), 0,
nullptr);
82 Dart_Handle namespace_args[] = {
83 Dart_NewInteger(
reinterpret_cast<intptr_t
>(fdio_ns_.
get())),
85 result = Dart_Invoke(namespace_type,
tonic::ToDart(
"_setupNamespace"), 1,
IsolateConfigurator(UniqueFDIONS fdio_ns, zx::channel directory_request, zx::eventpair view_ref)
bool ConfigureCurrentIsolate()
#define FML_CHECK(condition)
void Initialize(zx::channel directory_request, std::optional< zx::eventpair > view_ref)
Initializes Dart bindings for the Fuchsia application model.
Dart_Handle ToDart(const T &object)
bool CheckAndHandleError(Dart_Handle handle)