diff --git a/content_handler/BUILD.gn b/content_handler/BUILD.gn index e03bfbe1861..c4eb4940dd8 100644 --- a/content_handler/BUILD.gn +++ b/content_handler/BUILD.gn @@ -63,7 +63,7 @@ template("flutter_content_handler") { "//lib/fidl/dart/sdk_ext", "//lib/ftl", "//lib/mtl", - "//lib/tonic/mx", + "//lib/tonic", "//lib/zip", "//magma:vulkan", "//third_party/rapidjson", diff --git a/content_handler/runtime_holder.cc b/content_handler/runtime_holder.cc index 37d68a43a4c..30b6d0ca033 100644 --- a/content_handler/runtime_holder.cc +++ b/content_handler/runtime_holder.cc @@ -25,13 +25,14 @@ #include "lib/ftl/logging.h" #include "lib/ftl/time/time_delta.h" #include "lib/mtl/vmo/vector.h" -#include "lib/tonic/mx/mx_converter.h" +#include "lib/tonic/handle_table.h" #include "lib/zip/create_unzipper.h" #include "third_party/rapidjson/rapidjson/document.h" #include "third_party/rapidjson/rapidjson/stringbuffer.h" #include "third_party/rapidjson/rapidjson/writer.h" using tonic::DartConverter; +using tonic::HandleTable; using tonic::ToDart; namespace flutter_runner { @@ -364,13 +365,15 @@ void RuntimeHolder::InitFidlInternal() { DART_CHECK_VALID(Dart_SetNativeResolver( fidl_internal, fidl::dart::NativeLookup, fidl::dart::NativeSymbol)); - DART_CHECK_VALID(Dart_SetField( - fidl_internal, ToDart("_environment"), - DartConverter::ToDart(environment.PassHandle()))); + HandleTable& handle_table = HandleTable::Current(); - DART_CHECK_VALID(Dart_SetField( - fidl_internal, ToDart("_outgoingServices"), - DartConverter::ToDart(outgoing_services_.PassChannel()))); + DART_CHECK_VALID( + Dart_SetField(fidl_internal, ToDart("_environment"), + handle_table.AddAndWrap(environment.PassHandle()))); + + DART_CHECK_VALID( + Dart_SetField(fidl_internal, ToDart("_outgoingServices"), + handle_table.AddAndWrap(outgoing_services_.PassChannel()))); } void RuntimeHolder::InitMozartInternal() { @@ -388,9 +391,10 @@ void RuntimeHolder::InitMozartInternal() { DartConverter::ToDart(reinterpret_cast( static_cast(this))))); - DART_CHECK_VALID(Dart_SetField( - mozart_internal, ToDart("_viewContainer"), - DartConverter::ToDart(view_container.PassHandle()))); + HandleTable& handle_table = HandleTable::Current(); + DART_CHECK_VALID( + Dart_SetField(mozart_internal, ToDart("_viewContainer"), + handle_table.AddAndWrap(view_container.PassHandle()))); } void RuntimeHolder::InitRootBundle(std::vector bundle) { diff --git a/lib/ui/compositing/scene_host.cc b/lib/ui/compositing/scene_host.cc index 1635b64bc79..63be9f7aa6e 100644 --- a/lib/ui/compositing/scene_host.cc +++ b/lib/ui/compositing/scene_host.cc @@ -8,6 +8,10 @@ #include "lib/tonic/dart_binding_macros.h" #include "lib/tonic/dart_library_natives.h" +#if defined(OS_FUCHSIA) +#include "lib/tonic/handle_table.h" +#endif + namespace blink { static void SceneHost_constructor(Dart_NativeArguments args) { @@ -31,7 +35,8 @@ ftl::RefPtr SceneHost::create(int export_token_handle) { SceneHost::SceneHost(int export_token_handle) { #if defined(OS_FUCHSIA) - export_node_ = ftl::MakeRefCounted(export_token_handle); + export_node_ = ftl::MakeRefCounted( + tonic::HandleTable::Current().Unwrap(export_token_handle)); #endif }