From d5338ed14376f62b252078b1dcd742bd3b01a7da Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Thu, 1 Feb 2018 22:47:01 -0800 Subject: [PATCH] [fuchsia] Set up the namespace in dart:zircon (#4628) --- content_handler/runtime_holder.cc | 12 ++++++++++++ content_handler/runtime_holder.h | 1 + runtime/dart_vm_entry_points_fuchsia.txt | 1 + 3 files changed, 14 insertions(+) diff --git a/content_handler/runtime_holder.cc b/content_handler/runtime_holder.cc index cc194924b582c..8d91901ed75b2 100644 --- a/content_handler/runtime_holder.cc +++ b/content_handler/runtime_holder.cc @@ -398,6 +398,7 @@ void RuntimeHolder::DidCreateMainIsolate(Dart_Isolate isolate) { } InitDartIoInternal(); InitFuchsia(); + InitZircon(); InitMozartInternal(); } @@ -434,6 +435,17 @@ void RuntimeHolder::InitFuchsia() { ConnectToService(parent_env_service_provider.get(), clipboard_.NewRequest()); } +void RuntimeHolder::InitZircon() { + Dart_Handle zircon_lib = Dart_LookupLibrary(ToDart("dart:zircon")); + DART_CHECK_VALID(zircon_lib); + + Dart_Handle namespace_type = + Dart_GetType(zircon_lib, ToDart("_Namespace"), 0, nullptr); + DART_CHECK_VALID(namespace_type); + DART_CHECK_VALID(Dart_SetField(namespace_type, ToDart("_namespace"), + ToDart(reinterpret_cast(namespc_)))); +} + void RuntimeHolder::InitMozartInternal() { fidl::InterfaceHandle view_container; view_->GetContainer(view_container.NewRequest()); diff --git a/content_handler/runtime_holder.h b/content_handler/runtime_holder.h index 4b616c979d6d9..b254b13f6903a 100644 --- a/content_handler/runtime_holder.h +++ b/content_handler/runtime_holder.h @@ -99,6 +99,7 @@ class RuntimeHolder : public blink::RuntimeDelegate, void InitDartIoInternal(); void InitFuchsia(); + void InitZircon(); void InitMozartInternal(); void PostBeginFrame(); diff --git a/runtime/dart_vm_entry_points_fuchsia.txt b/runtime/dart_vm_entry_points_fuchsia.txt index f6e90764215bd..1219d3a319fd4 100644 --- a/runtime/dart_vm_entry_points_fuchsia.txt +++ b/runtime/dart_vm_entry_points_fuchsia.txt @@ -4,6 +4,7 @@ dart:io,_EmbedderConfig,_mayExit dart:io,_Namespace,_setupNamespace dart:mozart.internal,::,_context dart:mozart.internal,::,_viewContainer +dart:zircon,_Namespace,_namespace dart:zircon,GetSizeResult,GetSizeResult. dart:zircon,Handle,Handle._ dart:zircon,HandlePairResult,HandlePairResult.