From d1ba46c05e554112859b80eb354d7362996af835 Mon Sep 17 00:00:00 2001 From: Miguel Flores Ruiz de Eguino Date: Mon, 12 Feb 2024 18:18:01 +0000 Subject: [PATCH] [inspect] Update Inspect library usage The new Inspect library uses InspectSink as described in RFC-168 [1]. Additionally it's using the new CPP bindings instead of the deprecated HLCPP bindings. [1]: https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0168_exposing_inspect_through_inspectsink?hl=en TEST=build locally together with the flutter engine and internal code. Bug: https://g-issues.fuchsia.dev/issues/320785253 Change-Id: Ide167f67217dd964167133c9aafd9e33ec81afc1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349220 Reviewed-by: Ryan Macnak Commit-Queue: Miguel Flores Auto-Submit: Miguel Flores --- runtime/platform/BUILD.gn | 6 +++--- runtime/platform/utils_fuchsia.cc | 12 +++++++----- runtime/vm.shard.cml | 1 + runtime/vm/BUILD.gn | 9 ++++----- runtime/vm/os_fuchsia.cc | 2 +- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/runtime/platform/BUILD.gn b/runtime/platform/BUILD.gn index f339a1e8a32..42422c40642 100644 --- a/runtime/platform/BUILD.gn +++ b/runtime/platform/BUILD.gn @@ -19,18 +19,18 @@ library_for_all_configs("libdart_platform") { if (is_fuchsia) { if (using_fuchsia_gn_sdk) { extra_deps += [ + "$fuchsia_sdk_root/pkg/inspect_component_cpp", "$fuchsia_sdk_root/pkg/sys_cpp", - "$fuchsia_sdk_root/pkg/sys_inspect_cpp", ] } else if (using_fuchsia_sdk) { extra_deps += [ + "$fuchsia_sdk_root/pkg:inspect_component_cpp", "$fuchsia_sdk_root/pkg:sys_cpp", - "$fuchsia_sdk_root/pkg:sys_inspect_cpp", ] } else { extra_deps += [ + "//sdk/lib/inspect/component/cpp", "//sdk/lib/sys/cpp", - "//sdk/lib/sys/inspect/cpp", ] } } diff --git a/runtime/platform/utils_fuchsia.cc b/runtime/platform/utils_fuchsia.cc index 8b9dee48e78..004f47500eb 100644 --- a/runtime/platform/utils_fuchsia.cc +++ b/runtime/platform/utils_fuchsia.cc @@ -8,8 +8,9 @@ #include #include +#include "lib/async/default.h" +#include "lib/inspect/component/cpp/component.h" #include "lib/sys/cpp/component_context.h" -#include "lib/sys/inspect/cpp/component.h" #include "platform/utils.h" #include "platform/utils_fuchsia.h" @@ -68,10 +69,11 @@ std::unique_ptr TakeDartVmNode() { // TODO(fxbug.dev/69558) Remove the creation of the node_ from this call // after the runners have been migrated to injecting this object. if (vm_node == nullptr) { - static std::unique_ptr component_inspector = - std::make_unique(dart::ComponentContext()); - inspect::Node& root = component_inspector->inspector()->GetRoot(); - vm_node = std::make_unique(root.CreateChild("vm")); + static std::unique_ptr component_inspector = + std::make_unique( + async_get_default_dispatcher(), inspect::PublishOptions{}); + vm_node = std::make_unique( + component_inspector->root().CreateChild("vm")); } return std::move(vm_node); } diff --git a/runtime/vm.shard.cml b/runtime/vm.shard.cml index 59f4821c72a..f96a36cf2d4 100644 --- a/runtime/vm.shard.cml +++ b/runtime/vm.shard.cml @@ -29,6 +29,7 @@ { protocol: [ "fuchsia.deprecatedtimezone.Timezone", + "fuchsia.inspect.InspectSink", "fuchsia.intl.PropertyProvider", "fuchsia.logger.LogSink", "fuchsia.net.name.Lookup", diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn index 4d24acd6bd2..c92b19b5bec 100644 --- a/runtime/vm/BUILD.gn +++ b/runtime/vm/BUILD.gn @@ -180,9 +180,8 @@ library_for_all_configs("libdart_vm") { "$fuchsia_sdk_root/pkg/async-loop", "$fuchsia_sdk_root/pkg/async-loop-default", "$fuchsia_sdk_root/pkg/inspect", - "$fuchsia_sdk_root/pkg/inspect_service_cpp", + "$fuchsia_sdk_root/pkg/inspect_component_cpp", "$fuchsia_sdk_root/pkg/sys_cpp", - "$fuchsia_sdk_root/pkg/sys_inspect_cpp", "$fuchsia_sdk_root/pkg/trace-engine", ] } else if (using_fuchsia_sdk) { @@ -191,17 +190,17 @@ library_for_all_configs("libdart_vm") { "$fuchsia_sdk_root/pkg:async-loop", "$fuchsia_sdk_root/pkg:async-loop-default", "$fuchsia_sdk_root/pkg:inspect", - "$fuchsia_sdk_root/pkg:inspect_service_cpp", + "$fuchsia_sdk_root/pkg:inspect_component_cpp", "$fuchsia_sdk_root/pkg:sys_cpp", - "$fuchsia_sdk_root/pkg:sys_inspect_cpp", "$fuchsia_sdk_root/pkg:trace-engine", ] } else { extra_deps += [ "//sdk/fidl/fuchsia.intl", + "//sdk/lib/inspect/component/cpp", "//sdk/lib/sys/cpp", - "//sdk/lib/sys/inspect/cpp", "//zircon/public/lib/fbl", + "//zircon/system/ulib/inspect", "//zircon/system/ulib/trace-engine", ] } diff --git a/runtime/vm/os_fuchsia.cc b/runtime/vm/os_fuchsia.cc index 3f7f03f6708..16569f7db48 100644 --- a/runtime/vm/os_fuchsia.cc +++ b/runtime/vm/os_fuchsia.cc @@ -19,10 +19,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include