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

Unified Diff: runtime/vm/service.cc

Issue 773573005: vmservice: basic object graph serialization. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years 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
« runtime/vm/object_graph.cc ('K') | « runtime/vm/service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service.cc
===================================================================
--- runtime/vm/service.cc (revision 41936)
+++ runtime/vm/service.cc (working copy)
@@ -2266,6 +2266,34 @@
}
+static bool HandleGraph(Isolate* isolate, JSONStream* js) {
+ Service::SendGraphEvent(isolate);
+ // TODO(koda): Provide some id that ties this request to async response(s).
+ JSONObject jsobj(js);
+ jsobj.AddProperty("type", "OK");
+ jsobj.AddProperty("id", "ok");
+ return true;
+}
+
+
+void Service::SendGraphEvent(Isolate* isolate) {
+ uint8_t* buffer = NULL;
+ WriteStream stream(&buffer, &allocator, 1 * MB);
+ ObjectGraph graph(isolate);
+ graph.Serialize(&stream);
+ JSONStream js;
+ {
+ JSONObject jsobj(&js);
+ jsobj.AddProperty("type", "ServiceEvent");
+ jsobj.AddPropertyF("id", "_graphEvent");
+ jsobj.AddProperty("eventType", "_Graph");
+ jsobj.AddProperty("isolate", isolate);
+ }
+ const String& message = String::Handle(String::New(js.ToCString()));
+ SendEvent(kEventFamilyDebug, message, buffer, stream.bytes_written());
+}
+
+
class ContainsAddressVisitor : public FindObjectVisitor {
public:
ContainsAddressVisitor(Isolate* isolate, uword addr)
@@ -2338,6 +2366,7 @@
{ "code", HandleCode },
{ "coverage", HandleCoverage },
{ "debug", HandleDebug },
+ { "graph", HandleGraph },
{ "heapmap", HandleHeapMap },
{ "libraries", HandleLibraries },
{ "metrics", HandleMetrics },
« runtime/vm/object_graph.cc ('K') | « runtime/vm/service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698