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

Side by Side Diff: runtime/vm/service.cc

Issue 3003903002: Hide internal classes from Memory Profile (Closed)
Patch Set: Add documentation Created 3 years, 3 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/service.h" 5 #include "vm/service.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 10
(...skipping 4053 matching lines...) Expand 10 before | Expand all | Expand 10 after
4064 PrintInvalidParamError(js, "classId"); 4064 PrintInvalidParamError(js, "classId");
4065 return true; 4065 return true;
4066 } 4066 }
4067 const Class& cls = Class::Handle(GetClassForId(isolate, cid)); 4067 const Class& cls = Class::Handle(GetClassForId(isolate, cid));
4068 ASSERT(!cls.IsNull()); 4068 ASSERT(!cls.IsNull());
4069 cls.SetTraceAllocation(enable); 4069 cls.SetTraceAllocation(enable);
4070 PrintSuccess(js); 4070 PrintSuccess(js);
4071 return true; 4071 return true;
4072 } 4072 }
4073 4073
4074 static const MethodParameter* get_default_classes_aliases_params[] = {
4075 NO_ISOLATE_PARAMETER, NULL,
4076 };
4077
4078 static bool GetDefaultClassesAliases(Thread* thread, JSONStream* js) {
4079 JSONObject jsobj(js);
4080 jsobj.AddProperty("type", "ClassesAliasesMap");
4081
4082 JSONObject map(&jsobj, "map");
4083
4084 #define DEFINE_ADD_VALUE_F(id) internals.AddValueF("classes/%d", id);
4085 #define DEFINE_ADD_VALUE_F_CID(clazz) DEFINE_ADD_VALUE_F(k##clazz##Cid)
4086 {
4087 JSONArray internals(&map, "<VM Internals>");
4088 for (int32_t id = kClassCid; id <= kMixinAppTypeCid; ++id) {
rmacnak 2017/08/28 22:51:08 intptr_t cid = kClassCid; cid < kInstanceCid; ++ci
4089 DEFINE_ADD_VALUE_F(id);
4090 }
4091 }
rmacnak 2017/08/28 22:51:08 AbstractType, Type, TypeRef, TypeParameter, Bounde
cbernaschina 2017/08/28 23:19:27 Done.
4092 {
4093 JSONArray internals(&map, "Closure");
4094 DEFINE_ADD_VALUE_F_CID(Closure);
rmacnak 2017/08/28 22:51:08 Maybe alias Context to Closure to blame context si
cbernaschina 2017/08/28 23:19:27 Done.
4095 }
4096 {
4097 JSONArray internals(&map, "Int");
4098 for (int32_t id = kIntegerCid; id <= kBigintCid; ++id) {
rmacnak 2017/08/28 22:51:08 intptr_t
cbernaschina 2017/08/28 23:19:27 Done.
4099 DEFINE_ADD_VALUE_F(id);
4100 }
4101 }
4102 {
4103 JSONArray internals(&map, "Double");
4104 DEFINE_ADD_VALUE_F_CID(Double);
4105 }
4106 {
4107 JSONArray internals(&map, "String");
4108 CLASS_LIST_STRINGS(DEFINE_ADD_VALUE_F_CID)
4109 }
4110 {
4111 JSONArray internals(&map, "List");
4112 CLASS_LIST_ARRAYS(DEFINE_ADD_VALUE_F_CID)
4113 DEFINE_ADD_VALUE_F_CID(GrowableObjectArray)
4114 DEFINE_ADD_VALUE_F_CID(ByteBuffer)
4115 }
4116 {
4117 JSONArray internals(&map, "Map");
4118 DEFINE_ADD_VALUE_F_CID(LinkedHashMap)
4119 }
4120 #define DEFINE_ADD_MAP_KEY(clazz) \
4121 { \
4122 JSONArray internals(&map, #clazz); \
4123 DEFINE_ADD_VALUE_F_CID(TypedData##clazz) \
4124 DEFINE_ADD_VALUE_F_CID(TypedData##clazz) \
4125 DEFINE_ADD_VALUE_F_CID(ExternalTypedData##clazz) \
4126 }
4127 CLASS_LIST_TYPED_DATA(DEFINE_ADD_MAP_KEY)
4128 #undef DEFINE_ADD_MAP_KEY
4129 #undef DEFINE_ADD_VALUE_F_CID
4130 #undef DEFINE_ADD_VALUE_F
4131
4132 return true;
4133 }
4134
4074 // clang-format off 4135 // clang-format off
4075 static const ServiceMethodDescriptor service_methods_[] = { 4136 static const ServiceMethodDescriptor service_methods_[] = {
4076 { "_dumpIdZone", DumpIdZone, NULL }, 4137 { "_dumpIdZone", DumpIdZone, NULL },
4077 { "_echo", Echo, 4138 { "_echo", Echo,
4078 NULL }, 4139 NULL },
4079 { "_respondWithMalformedJson", RespondWithMalformedJson, 4140 { "_respondWithMalformedJson", RespondWithMalformedJson,
4080 NULL }, 4141 NULL },
4081 { "_respondWithMalformedObject", RespondWithMalformedObject, 4142 { "_respondWithMalformedObject", RespondWithMalformedObject,
4082 NULL }, 4143 NULL },
4083 { "_triggerEchoEvent", TriggerEchoEvent, 4144 { "_triggerEchoEvent", TriggerEchoEvent,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
4183 { "setName", SetName, 4244 { "setName", SetName,
4184 set_name_params }, 4245 set_name_params },
4185 { "_setTraceClassAllocation", SetTraceClassAllocation, 4246 { "_setTraceClassAllocation", SetTraceClassAllocation,
4186 set_trace_class_allocation_params }, 4247 set_trace_class_allocation_params },
4187 { "setVMName", SetVMName, 4248 { "setVMName", SetVMName,
4188 set_vm_name_params }, 4249 set_vm_name_params },
4189 { "_setVMTimelineFlags", SetVMTimelineFlags, 4250 { "_setVMTimelineFlags", SetVMTimelineFlags,
4190 set_vm_timeline_flags_params }, 4251 set_vm_timeline_flags_params },
4191 { "_collectAllGarbage", CollectAllGarbage, 4252 { "_collectAllGarbage", CollectAllGarbage,
4192 collect_all_garbage_params }, 4253 collect_all_garbage_params },
4254 { "_getDefaultClassesAliases", GetDefaultClassesAliases,
4255 get_default_classes_aliases_params },
4193 }; 4256 };
4194 // clang-format on 4257 // clang-format on
4195 4258
4196 const ServiceMethodDescriptor* FindMethod(const char* method_name) { 4259 const ServiceMethodDescriptor* FindMethod(const char* method_name) {
4197 intptr_t num_methods = sizeof(service_methods_) / sizeof(service_methods_[0]); 4260 intptr_t num_methods = sizeof(service_methods_) / sizeof(service_methods_[0]);
4198 for (intptr_t i = 0; i < num_methods; i++) { 4261 for (intptr_t i = 0; i < num_methods; i++) {
4199 const ServiceMethodDescriptor& method = service_methods_[i]; 4262 const ServiceMethodDescriptor& method = service_methods_[i];
4200 if (strcmp(method_name, method.name) == 0) { 4263 if (strcmp(method_name, method.name) == 0) {
4201 return &method; 4264 return &method;
4202 } 4265 }
4203 } 4266 }
4204 return NULL; 4267 return NULL;
4205 } 4268 }
4206 4269
4207 #endif // !PRODUCT 4270 #endif // !PRODUCT
4208 4271
4209 } // namespace dart 4272 } // namespace dart
OLDNEW
« 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