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

Unified Diff: runtime/vm/service.cc

Issue 266323002: Class view: Retained size of all instances. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/elements/class_view.html ('k') | runtime/vm/service_test.cc » ('j') | 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 35762)
+++ runtime/vm/service.cc (working copy)
@@ -1066,6 +1066,20 @@
}
+static bool HandleClassesRetained(Isolate* isolate, const Class& cls,
+ JSONStream* js) {
+ if (js->num_arguments() != 3) {
+ PrintError(js, "Command too long");
+ return true;
+ }
+ ObjectGraph graph(isolate);
+ intptr_t retained_size = graph.SizeRetainedByClass(cls.id());
+ const Object& result = Object::Handle(Integer::New(retained_size));
+ result.PrintJSON(js, true);
+ return true;
+}
+
+
static bool HandleClasses(Isolate* isolate, JSONStream* js) {
if (js->num_arguments() == 1) {
ClassTable* table = isolate->class_table();
@@ -1104,6 +1118,8 @@
return HandleClassesDispatchers(isolate, cls, js);
} else if (!strcmp(second, "types")) {
return HandleClassesTypes(isolate, cls, js);
+ } else if (!strcmp(second, "retained")) {
+ return HandleClassesRetained(isolate, cls, js);
} else {
PrintError(js, "Invalid sub collection %s", second);
return true;
« no previous file with comments | « runtime/bin/vmservice/client/lib/src/elements/class_view.html ('k') | runtime/vm/service_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698