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

Unified Diff: runtime/vm/service.cc

Issue 3003903002: Hide internal classes from Memory Profile (Closed)
Patch Set: Address CL comments Created 3 years, 4 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/observatory/tests/observatory_ui/mocks/repositories/allocation_profile.dart ('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
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 6dd4f5f98e75c7f04b5441ca79a3977ce787c58f..05247c910b009ee863cddad2f5def4c3121ea33d 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -4077,6 +4077,80 @@ static bool SetTraceClassAllocation(Thread* thread, JSONStream* js) {
return true;
}
+static const MethodParameter* get_default_classes_aliases_params[] = {
+ NO_ISOLATE_PARAMETER, NULL,
+};
+
+static bool GetDefaultClassesAliases(Thread* thread, JSONStream* js) {
+ JSONObject jsobj(js);
+ jsobj.AddProperty("type", "ClassesAliasesMap");
+
+ JSONObject map(&jsobj, "map");
+
+#define DEFINE_ADD_VALUE_F(id) \
+ internals.AddValueF("classes/%" Pd, static_cast<intptr_t>(id));
siva 2017/08/28 23:31:16 Is the static cast needed?
cbernaschina 2017/08/28 23:36:16 enumerations are default converted to the smaller
+#define DEFINE_ADD_VALUE_F_CID(clazz) DEFINE_ADD_VALUE_F(k##clazz##Cid)
+ {
+ JSONArray internals(&map, "<VM Internals>");
+ for (intptr_t id = kClassCid; id < kInstanceCid; ++id) {
+ DEFINE_ADD_VALUE_F(id);
+ }
+ DEFINE_ADD_VALUE_F_CID(LibraryPrefix);
+ }
+ {
+ JSONArray internals(&map, "Type");
+ for (intptr_t id = kAbstractTypeCid; id <= kMixinAppTypeCid; ++id) {
+ DEFINE_ADD_VALUE_F(id);
+ }
+ }
+ {
+ JSONArray internals(&map, "Object");
+ DEFINE_ADD_VALUE_F_CID(Instance);
+ }
+ {
+ JSONArray internals(&map, "Closure");
+ DEFINE_ADD_VALUE_F_CID(Closure);
+ DEFINE_ADD_VALUE_F_CID(Context);
+ }
+ {
+ JSONArray internals(&map, "Int");
+ for (intptr_t id = kIntegerCid; id <= kBigintCid; ++id) {
+ DEFINE_ADD_VALUE_F(id);
+ }
+ }
+ {
+ JSONArray internals(&map, "Double");
+ DEFINE_ADD_VALUE_F_CID(Double);
+ }
+ {
+ JSONArray internals(&map, "String");
+ CLASS_LIST_STRINGS(DEFINE_ADD_VALUE_F_CID)
+ }
+ {
+ JSONArray internals(&map, "List");
+ CLASS_LIST_ARRAYS(DEFINE_ADD_VALUE_F_CID)
+ DEFINE_ADD_VALUE_F_CID(GrowableObjectArray)
+ DEFINE_ADD_VALUE_F_CID(ByteBuffer)
siva 2017/08/28 23:31:16 Array and ImmutableArray also needs to be in this
cbernaschina 2017/08/28 23:36:17 They are listed via the CLASS_LIST_ARRAYS macro
+ }
+ {
+ JSONArray internals(&map, "Map");
+ DEFINE_ADD_VALUE_F_CID(LinkedHashMap)
+ }
+#define DEFINE_ADD_MAP_KEY(clazz) \
+ { \
+ JSONArray internals(&map, #clazz); \
+ DEFINE_ADD_VALUE_F_CID(TypedData##clazz) \
+ DEFINE_ADD_VALUE_F_CID(TypedData##clazz) \
+ DEFINE_ADD_VALUE_F_CID(ExternalTypedData##clazz) \
+ }
+ CLASS_LIST_TYPED_DATA(DEFINE_ADD_MAP_KEY)
+#undef DEFINE_ADD_MAP_KEY
+#undef DEFINE_ADD_VALUE_F_CID
+#undef DEFINE_ADD_VALUE_F
+
+ return true;
+}
+
// clang-format off
static const ServiceMethodDescriptor service_methods_[] = {
{ "_dumpIdZone", DumpIdZone, NULL },
@@ -4196,6 +4270,8 @@ static const ServiceMethodDescriptor service_methods_[] = {
set_vm_timeline_flags_params },
{ "_collectAllGarbage", CollectAllGarbage,
collect_all_garbage_params },
+ { "_getDefaultClassesAliases", GetDefaultClassesAliases,
+ get_default_classes_aliases_params },
};
// clang-format on
« no previous file with comments | « runtime/observatory/tests/observatory_ui/mocks/repositories/allocation_profile.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698