Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2234)

Unified Diff: runtime/vm/port.cc

Issue 1189543003: Ports page for isolates (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/port.cc
diff --git a/runtime/vm/port.cc b/runtime/vm/port.cc
index 5a7506852cfe941ece58c05bc03907f0e7813704..3451ec6b34995197f24c9218e33e557911cf7536 100644
--- a/runtime/vm/port.cc
+++ b/runtime/vm/port.cc
@@ -4,6 +4,7 @@
#include "vm/port.h"
+#include "vm/dart_entry.h"
#include "platform/utils.h"
#include "vm/dart_api_impl.h"
#include "vm/isolate.h"
@@ -301,4 +302,27 @@ void PortMap::InitOnce() {
deleted_ = 0;
}
+
+void PortMap::PrintPortsForMessageHandler(MessageHandler* handler,
+ JSONStream* stream) {
+ JSONObject jsobj(stream);
+ jsobj.AddProperty("type", "_Ports");
+ Object& msg_handler = Object::Handle();
+ {
+ JSONArray ports(&jsobj, "ports");
+ MutexLocker ml(mutex_);
+ for (intptr_t i = 0; i < capacity_; i++) {
+ if (map_[i].handler == handler) {
+ if (map_[i].state == kLivePort) {
+ JSONObject port(&ports);
+ port.AddProperty("type", "_Port");
+ port.AddPropertyF("name", "Isolate Port (%" Pd64 ")", map_[i].port);
+ msg_handler = DartLibraryCalls::LookupHandler(map_[i].port);
+ port.AddProperty("handler", msg_handler);
+ }
+ }
+ }
+ }
+}
+
} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698