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

Commit fc4c7d7

Browse files
authored
[vm_service] Add vm service port to inspect. (#26295)
fxb/75455
1 parent 9d919e1 commit fc4c7d7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

shell/platform/fuchsia/flutter/runner.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <fcntl.h>
88
#include <fuchsia/mem/cpp/fidl.h>
99
#include <lib/async/cpp/task.h>
10+
#include <lib/inspect/cpp/inspect.h>
1011
#include <lib/trace-engine/instrumentation.h>
1112
#include <zircon/status.h>
1213
#include <zircon/types.h>
@@ -20,6 +21,7 @@
2021
#include "flutter/runtime/dart_vm.h"
2122
#include "lib/sys/cpp/component_context.h"
2223
#include "runtime/dart/utils/files.h"
24+
#include "runtime/dart/utils/root_inspect_node.h"
2325
#include "runtime/dart/utils/vmo.h"
2426
#include "runtime/dart/utils/vmservice_object.h"
2527
#include "third_party/icu/source/common/unicode/udata.h"
@@ -156,6 +158,22 @@ Runner::Runner(async::Loop* loop, sys::ComponentContext* context)
156158
dart_utils::VMServiceObject::kPortDirName,
157159
std::make_unique<dart_utils::VMServiceObject>());
158160

161+
inspect::Inspector* inspector = dart_utils::RootInspectNode::GetInspector();
162+
inspector->GetRoot().CreateLazyValues(
163+
"vmservice_port",
164+
[&]() {
165+
inspect::Inspector inspector;
166+
dart_utils::VMServiceObject::LazyEntryVector out;
167+
dart_utils::VMServiceObject().GetContents(&out);
168+
std::string name = "";
169+
if (out.size() > 0) {
170+
name = out[0].name;
171+
}
172+
inspector.GetRoot().CreateString("vm_service_port", name, &inspector);
173+
return fit::make_ok_promise(inspector);
174+
},
175+
inspector);
176+
159177
SetupTraceObserver();
160178
#endif // !defined(DART_PRODUCT)
161179

0 commit comments

Comments
 (0)