Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit b39f3ed

Browse files
committed
[fuchsia] 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 Bug: https://g-issues.fuchsia.dev/issues/320785253
1 parent ee297c0 commit b39f3ed

File tree

22 files changed

+37
-56
lines changed

22 files changed

+37
-56
lines changed

shell/platform/fuchsia/dart_runner/BUILD.gn

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ template("runner_sources") {
5858
"$fuchsia_sdk_root/pkg:async-loop-cpp",
5959
"$fuchsia_sdk_root/pkg:async-loop-default",
6060
"$fuchsia_sdk_root/pkg:fidl_cpp",
61+
"$fuchsia_sdk_root/pkg:inspect",
62+
"$fuchsia_sdk_root/pkg:inspect_component_cpp",
6163
"$fuchsia_sdk_root/pkg:sys_cpp",
6264
"$fuchsia_sdk_root/pkg:sys_cpp_testing",
63-
"$fuchsia_sdk_root/pkg:sys_inspect_cpp",
6465
"$fuchsia_sdk_root/pkg:trace",
6566
"$fuchsia_sdk_root/pkg:vfs_cpp",
6667
"$fuchsia_sdk_root/pkg:zx",
@@ -99,7 +100,7 @@ template("runner") {
99100

100101
deps = [
101102
":" + target_name + "_runner_sources",
102-
"$fuchsia_sdk_root/pkg:sys_inspect_cpp",
103+
"$fuchsia_sdk_root/pkg:inspect_component_cpp",
103104
"$fuchsia_sdk_root/pkg:trace-provider-so",
104105
] + extra_deps
105106
}

shell/platform/fuchsia/dart_runner/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include <lib/async-loop/cpp/loop.h>
66
#include <lib/async-loop/default.h>
7-
#include <lib/sys/inspect/cpp/component.h>
7+
#include <lib/inspect/cpp/vmo/types.h>
88
#include <lib/trace-provider/provider.h>
99
#include <lib/trace/event.h>
1010

shell/platform/fuchsia/dart_runner/meta/common.shard.cml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44
{
5-
capabilities: [
6-
// Required for inspect.
7-
// Copied from inspect/client.shard.cml because out-of-tree doesn't
8-
// have support for CML includes from the SDK.
9-
{
10-
directory: "diagnostics",
11-
rights: [ "connect" ],
12-
path: "/diagnostics",
13-
},
14-
],
155
use: [
166
// This is used by the Dart VM to communicate from Dart code to C++ code.
177
{
@@ -36,6 +26,7 @@
3626
protocol: [
3727
"fuchsia.device.NameProvider", // For fdio uname()
3828
"fuchsia.feedback.CrashReporter",
29+
"fuchsia.inspect.InspectSink", // For inspect
3930
"fuchsia.intl.PropertyProvider", // For dartVM timezone support
4031
"fuchsia.logger.LogSink", // For syslog
4132
"fuchsia.net.name.Lookup", // For fdio sockets
@@ -50,15 +41,5 @@
5041
from: "parent",
5142
availability: "optional",
5243
},
53-
],
54-
expose: [
55-
// Required for inspect.
56-
// Copied from inspect/client.shard.cml because out-of-tree doesn't
57-
// have support for CML includes from the SDK.
58-
{
59-
directory: "diagnostics",
60-
from: "self",
61-
to: "framework",
62-
},
63-
],
44+
]
6445
}

shell/platform/fuchsia/dart_runner/tests/startup_integration_test/dart_aot_runner/dart-aot-runner-integration-test.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ TEST_F(RealmBuilderTest, DartRunnerStartsUp) {
8383
Protocol{"fuchsia.posix.socket.Provider"},
8484
Protocol{"fuchsia.intl.PropertyProvider"},
8585
Protocol{"fuchsia.vulkan.loader.Loader"},
86+
Protocol{"fuchsia.inspect.InspectSink"},
8687
Directory{"config-data"}},
8788
.source = ParentRef(),
8889
.targets = {kDartAotRunnerRef, kDartAotEchoServerRef}});

shell/platform/fuchsia/dart_runner/tests/startup_integration_test/dart_aot_runner/meta/dart-aot-runner-integration-test.cml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// Offer capabilities needed by components in this test realm.
2020
// Keep it minimal, describe only what's actually needed.
2121
protocol: [
22+
"fuchsia.inspect.InspectSink",
2223
"fuchsia.logger.LogSink",
2324
"fuchsia.sysmem.Allocator",
2425
"fuchsia.tracing.provider.Registry",

shell/platform/fuchsia/dart_runner/tests/startup_integration_test/dart_jit_runner/dart-jit-runner-integration-test.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ TEST_F(RealmBuilderTest, DartRunnerStartsUp) {
8181
Protocol{"fuchsia.tracing.provider.Registry"},
8282
Protocol{"fuchsia.posix.socket.Provider"},
8383
Protocol{"fuchsia.intl.PropertyProvider"},
84+
Protocol{"fuchsia.inspect.InspectSink"},
8485
Directory{"config-data"}},
8586
.source = ParentRef(),
8687
.targets = {kDartJitRunnerRef, kDartJitEchoServerRef}});

shell/platform/fuchsia/dart_runner/tests/startup_integration_test/dart_jit_runner/meta/dart-jit-runner-integration-test.cml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// Offer capabilities needed by components in this test realm.
2020
// Keep it minimal, describe only what's actually needed.
2121
protocol: [
22+
"fuchsia.inspect.InspectSink",
2223
"fuchsia.logger.LogSink",
2324
"fuchsia.sysmem.Allocator",
2425
"fuchsia.tracing.provider.Registry",

shell/platform/fuchsia/flutter/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ template("runner_sources") {
140140

141141
public_deps = [
142142
"$fuchsia_sdk_root/pkg:inspect",
143+
"$fuchsia_sdk_root/pkg:inspect_component_cpp",
143144
"$fuchsia_sdk_root/pkg:sys_cpp",
144-
"$fuchsia_sdk_root/pkg:sys_inspect_cpp",
145145
"//flutter/shell/platform/fuchsia/runtime/dart/utils",
146146
] + flutter_public_deps
147147

shell/platform/fuchsia/flutter/accessibility_bridge.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <fuchsia/accessibility/semantics/cpp/fidl.h>
1313
#include <fuchsia/ui/gfx/cpp/fidl.h>
1414
#include <lib/fidl/cpp/binding_set.h>
15-
#include <lib/sys/inspect/cpp/component.h>
15+
#include <lib/inspect/cpp/vmo/types.h>
1616
#include <zircon/types.h>
1717

1818
#include <memory>

shell/platform/fuchsia/flutter/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// found in the LICENSE file.
44

55
#include <lib/async-loop/cpp/loop.h>
6-
#include <lib/sys/inspect/cpp/component.h>
6+
#include <lib/inspect/cpp/vmo/types.h>
77
#include <lib/trace-provider/provider.h>
88
#include <lib/trace/event.h>
99

shell/platform/fuchsia/flutter/meta/common.shard.cml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file
44
{
5-
capabilities: [
6-
// Required for inspect.
7-
// Copied from inspect/client.shard.cml because out-of-tree doesn't
8-
// have support for CML includes from the SDK.
9-
{
10-
directory: "diagnostics",
11-
rights: [ "connect" ],
12-
path: "/diagnostics",
13-
},
14-
],
155
use: [
166
// This is used by the Dart VM to communicate from Dart code to C++ code.
177
{
@@ -43,6 +33,7 @@
4333
"fuchsia.device.NameProvider",
4434
"fuchsia.feedback.CrashReporter",
4535
"fuchsia.fonts.Provider",
36+
"fuchsia.inspect.InspectSink", // Copied from inspect/client.shard.cml.
4637
"fuchsia.intl.PropertyProvider",
4738
"fuchsia.logger.LogSink", // Copied from syslog/client.shard.cml.
4839
"fuchsia.media.ProfileProvider",
@@ -64,15 +55,5 @@
6455
],
6556
availability: "optional",
6657
},
67-
],
68-
expose: [
69-
// Required for inspect.
70-
// Copied from inspect/client.shard.cml because out-of-tree doesn't
71-
// have support for CML includes from the SDK.
72-
{
73-
directory: "diagnostics",
74-
from: "self",
75-
to: "framework",
76-
},
77-
],
58+
]
7859
}

shell/platform/fuchsia/flutter/tests/integration/embedder/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ executable("flutter-embedder-test-bin") {
2323
libs = [ "$fuchsia_sdk_path/arch/$target_cpu/sysroot/lib/libzircon.so" ]
2424

2525
deps = [
26+
"$fuchsia_sdk_root/fidl:fuchsia.inspect",
2627
"$fuchsia_sdk_root/fidl:fuchsia.logger",
2728
"$fuchsia_sdk_root/fidl:fuchsia.tracing.provider",
2829
"$fuchsia_sdk_root/fidl:fuchsia.ui.app",

shell/platform/fuchsia/flutter/tests/integration/embedder/flutter-embedder-test.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
#include <fuchsia/inspect/cpp/fidl.h>
56
#include <fuchsia/logger/cpp/fidl.h>
67
#include <fuchsia/tracing/provider/cpp/fidl.h>
78
#include <fuchsia/ui/app/cpp/fidl.h>
@@ -232,6 +233,7 @@ void FlutterEmbedderTest::SetUpRealmBase() {
232233
Route{.capabilities =
233234
{
234235
Protocol{fuchsia::logger::LogSink::Name_},
236+
Protocol{fuchsia::inspect::InspectSink::Name_},
235237
Protocol{fuchsia::sysmem::Allocator::Name_},
236238
Protocol{fuchsia::tracing::provider::Registry::Name_},
237239
Protocol{kVulkanLoaderServiceName},
@@ -243,6 +245,7 @@ void FlutterEmbedderTest::SetUpRealmBase() {
243245
// Route base system services to the test UI stack.
244246
realm_builder_.AddRoute(Route{
245247
.capabilities = {Protocol{fuchsia::logger::LogSink::Name_},
248+
Protocol{fuchsia::inspect::InspectSink::Name_},
246249
Protocol{fuchsia::sysmem::Allocator::Name_},
247250
Protocol{fuchsia::tracing::provider::Registry::Name_},
248251
Protocol{kVulkanLoaderServiceName}},

shell/platform/fuchsia/flutter/tests/integration/embedder/meta/flutter-embedder-test.cml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
// Offer capabilities needed by components in this test realm.
1919
// Keep it minimal, describe only what's actually needed.
2020
protocol: [
21+
"fuchsia.inspect.InspectSink",
2122
"fuchsia.logger.LogSink",
2223
"fuchsia.sysmem.Allocator",
2324
"fuchsia.tracing.provider.Registry",

shell/platform/fuchsia/flutter/tests/integration/mouse-input/meta/mouse-input-test.cml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
// Offer capabilities needed by components in this test realm.
2626
// Keep it minimal, describe only what's actually needed.
2727
protocol: [
28+
"fuchsia.inspect.InspectSink",
2829
"fuchsia.kernel.RootJobForInspect",
2930
"fuchsia.kernel.Stats",
3031
"fuchsia.logger.LogSink",

shell/platform/fuchsia/flutter/tests/integration/text-input/meta/text-input-test.cml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
offer: [
2525
{
2626
protocol: [
27+
"fuchsia.inspect.InspectSink",
2728
"fuchsia.kernel.RootJobForInspect",
2829
"fuchsia.kernel.Stats",
2930
"fuchsia.logger.LogSink",

shell/platform/fuchsia/flutter/tests/integration/touch-input/meta/touch-input-test.cml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
// Offer capabilities needed by components in this test realm.
2626
// Keep it minimal, describe only what's actually needed.
2727
protocol: [
28+
"fuchsia.inspect.InspectSink",
2829
"fuchsia.kernel.RootJobForInspect",
2930
"fuchsia.kernel.Stats",
3031
"fuchsia.logger.LogSink",

shell/platform/fuchsia/flutter/tests/integration/utils/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ source_set("portable_ui_test") {
4141

4242
deps = [
4343
":check_view",
44+
"$fuchsia_sdk_root/fidl:fuchsia.inspect",
4445
"$fuchsia_sdk_root/fidl:fuchsia.logger",
4546
"$fuchsia_sdk_root/fidl:fuchsia.ui.app",
4647
"$fuchsia_sdk_root/fidl:fuchsia.ui.composition",

shell/platform/fuchsia/flutter/tests/integration/utils/portable_ui_test.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include "portable_ui_test.h"
66

7+
#include <fuchsia/inspect/cpp/fidl.h>
78
#include <fuchsia/logger/cpp/fidl.h>
89
#include <fuchsia/tracing/provider/cpp/fidl.h>
910
#include <fuchsia/ui/app/cpp/fidl.h>
@@ -77,6 +78,7 @@ void PortableUITest::SetUpRealmBase() {
7778
// // Route base system services to flutter and the test UI stack.
7879
realm_builder_.AddRoute(Route{
7980
.capabilities = {Protocol{fuchsia::logger::LogSink::Name_},
81+
Protocol{fuchsia::inspect::InspectSink::Name_},
8082
Protocol{fuchsia::sysmem::Allocator::Name_},
8183
Protocol{fuchsia::tracing::provider::Registry::Name_},
8284
Protocol{fuchsia::ui::input::ImeService::Name_},

shell/platform/fuchsia/runtime/dart/utils/BUILD.gn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ template("make_utils") {
4444
"$fuchsia_sdk_root/pkg:async-loop-default",
4545
"$fuchsia_sdk_root/pkg:fdio",
4646
"$fuchsia_sdk_root/pkg:sys_cpp",
47-
"$fuchsia_sdk_root/pkg:sys_inspect_cpp",
47+
"$fuchsia_sdk_root/pkg:inspect_component_cpp",
4848
"$fuchsia_sdk_root/pkg:trace",
4949
"$fuchsia_sdk_root/pkg:vfs_cpp",
5050
"$fuchsia_sdk_root/pkg:zx",
@@ -99,7 +99,7 @@ executable("dart_utils_unittests") {
9999
deps = [
100100
":utils",
101101
":utils_fixtures",
102-
"$fuchsia_sdk_root/pkg:sys_inspect_cpp",
102+
"$fuchsia_sdk_root/pkg:inspect_component_cpp",
103103
"//flutter/testing",
104104
"//third_party/dart/runtime:libdart_jit",
105105
"//third_party/dart/runtime/bin:dart_io_api",

shell/platform/fuchsia/runtime/dart/utils/root_inspect_node.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,28 @@
33
// found in the LICENSE file.
44

55
#include "root_inspect_node.h"
6+
#include <lib/async/default.h>
67

78
namespace dart_utils {
89

9-
std::unique_ptr<sys::ComponentInspector> RootInspectNode::inspector_;
10+
std::unique_ptr<inspect::ComponentInspector> RootInspectNode::inspector_;
1011
std::mutex RootInspectNode::mutex_;
1112

1213
void RootInspectNode::Initialize(sys::ComponentContext* context) {
1314
std::lock_guard<std::mutex> lock(mutex_);
1415
if (!inspector_) {
15-
inspector_ = std::make_unique<sys::ComponentInspector>(context);
16+
inspector_ = std::make_unique<inspect::ComponentInspector>(
17+
async_get_default_dispatcher(), inspect::PublishOptions{});
1618
}
1719
}
1820

1921
inspect::Node RootInspectNode::CreateRootChild(const std::string& name) {
2022
std::lock_guard<std::mutex> lock(mutex_);
21-
return inspector_->inspector()->GetRoot().CreateChild(name);
23+
return inspector_->inspector().GetRoot().CreateChild(name);
2224
}
2325

2426
inspect::Inspector* RootInspectNode::GetInspector() {
25-
return inspector_->inspector();
27+
return &inspector_->inspector();
2628
}
2729

2830
} // namespace dart_utils

shell/platform/fuchsia/runtime/dart/utils/root_inspect_node.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_RUNTIME_DART_UTILS_ROOT_INSPECT_NODE_H_
66
#define FLUTTER_SHELL_PLATFORM_FUCHSIA_RUNTIME_DART_UTILS_ROOT_INSPECT_NODE_H_
77

8-
#include <lib/sys/inspect/cpp/component.h>
8+
#include <lib/inspect/component/cpp/component.h>
9+
#include <lib/sys/cpp/component_context.h>
910

1011
#include <memory>
1112
#include <mutex>
@@ -36,7 +37,7 @@ class RootInspectNode {
3637
static inspect::Inspector* GetInspector();
3738

3839
private:
39-
static std::unique_ptr<sys::ComponentInspector> inspector_;
40+
static std::unique_ptr<inspect::ComponentInspector> inspector_;
4041
static std::mutex mutex_;
4142
};
4243

0 commit comments

Comments
 (0)