[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 <rmacnak@google.com>
Commit-Queue: Miguel Flores <miguelfrde@google.com>
Auto-Submit: Miguel Flores <miguelfrde@google.com>
diff --git a/runtime/platform/BUILD.gn b/runtime/platform/BUILD.gn
index f339a1e..42422c4 100644
--- a/runtime/platform/BUILD.gn
+++ b/runtime/platform/BUILD.gn
@@ -19,18 +19,18 @@
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 8b9dee4..004f475 100644
--- a/runtime/platform/utils_fuchsia.cc
+++ b/runtime/platform/utils_fuchsia.cc
@@ -8,8 +8,9 @@
#include <memory>
#include <utility>
+#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 @@
// 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<sys::ComponentInspector> component_inspector =
- std::make_unique<sys::ComponentInspector>(dart::ComponentContext());
- inspect::Node& root = component_inspector->inspector()->GetRoot();
- vm_node = std::make_unique<inspect::Node>(root.CreateChild("vm"));
+ static std::unique_ptr<inspect::ComponentInspector> component_inspector =
+ std::make_unique<inspect::ComponentInspector>(
+ async_get_default_dispatcher(), inspect::PublishOptions{});
+ vm_node = std::make_unique<inspect::Node>(
+ component_inspector->root().CreateChild("vm"));
}
return std::move(vm_node);
}
diff --git a/runtime/vm.shard.cml b/runtime/vm.shard.cml
index 59f4821..f96a36c 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 4d24acd..c92b19b 100644
--- a/runtime/vm/BUILD.gn
+++ b/runtime/vm/BUILD.gn
@@ -180,9 +180,8 @@
"$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 @@
"$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 3f7f03f..16569f7 100644
--- a/runtime/vm/os_fuchsia.cc
+++ b/runtime/vm/os_fuchsia.cc
@@ -19,10 +19,10 @@
#include <lib/async-loop/default.h>
#include <lib/async-loop/loop.h>
#include <lib/async/default.h>
+#include <lib/inspect/component/cpp/component.h>
#include <lib/inspect/cpp/inspect.h>
#include <lib/sys/cpp/component_context.h>
#include <lib/sys/cpp/service_directory.h>
-#include <lib/sys/inspect/cpp/component.h>
#include <zircon/process.h>
#include <zircon/syscalls.h>
#include <zircon/syscalls/object.h>