[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>
This commit is contained in:
Miguel Flores Ruiz de Eguino
2024-02-12 18:18:01 +00:00
committed by Commit Queue
parent 9f7dbd6b4d
commit d1ba46c05e
5 changed files with 16 additions and 14 deletions
+3 -3
View File
@@ -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",
]
}
}
+7 -5
View File
@@ -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 @@ std::unique_ptr<inspect::Node> 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<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);
}
+1
View File
@@ -29,6 +29,7 @@
{
protocol: [
"fuchsia.deprecatedtimezone.Timezone",
"fuchsia.inspect.InspectSink",
"fuchsia.intl.PropertyProvider",
"fuchsia.logger.LogSink",
"fuchsia.net.name.Lookup",
+4 -5
View File
@@ -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",
]
}
+1 -1
View File
@@ -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>