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

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

Issue 3003903002: Hide internal classes from Memory Profile (Closed)
Patch Set: Address CL comments 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 4059 matching lines...) Expand 10 before | Expand all | Expand 10 after
4070 PrintInvalidParamError(js, "classId"); 4070 PrintInvalidParamError(js, "classId");
4071 return true; 4071 return true;
4072 } 4072 }
4073 const Class& cls = Class::Handle(GetClassForId(isolate, cid)); 4073 const Class& cls = Class::Handle(GetClassForId(isolate, cid));
4074 ASSERT(!cls.IsNull()); 4074 ASSERT(!cls.IsNull());
4075 cls.SetTraceAllocation(enable); 4075 cls.SetTraceAllocation(enable);
4076 PrintSuccess(js); 4076 PrintSuccess(js);
4077 return true; 4077 return true;
4078 } 4078 }
4079 4079
4080 static const MethodParameter* get_default_classes_aliases_params[] = {
4081 NO_ISOLATE_PARAMETER, NULL,
4082 };
4083
4084 static bool GetDefaultClassesAliases(Thread* thread, JSONStream* js) {
4085 JSONObject jsobj(js);
4086 jsobj.AddProperty("type", "ClassesAliasesMap");
4087
4088 JSONObject map(&jsobj, "map");
4089
4090 #define DEFINE_ADD_VALUE_F(id) \
4091 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
4092 #define DEFINE_ADD_VALUE_F_CID(clazz) DEFINE_ADD_VALUE_F(k##clazz##Cid)
4093 {
4094 JSONArray internals(&map, "<VM Internals>");
4095 for (intptr_t id = kClassCid; id < kInstanceCid; ++id) {
4096 DEFINE_ADD_VALUE_F(id);
4097 }
4098 DEFINE_ADD_VALUE_F_CID(LibraryPrefix);
4099 }
4100 {
4101 JSONArray internals(&map, "Type");
4102 for (intptr_t id = kAbstractTypeCid; id <= kMixinAppTypeCid; ++id) {
4103 DEFINE_ADD_VALUE_F(id);
4104 }
4105 }
4106 {
4107 JSONArray internals(&map, "Object");
4108 DEFINE_ADD_VALUE_F_CID(Instance);
4109 }
4110 {
4111 JSONArray internals(&map, "Closure");
4112 DEFINE_ADD_VALUE_F_CID(Closure);
4113 DEFINE_ADD_VALUE_F_CID(Context);
4114 }
4115 {
4116 JSONArray internals(&map, "Int");
4117 for (intptr_t id = kIntegerCid; id <= kBigintCid; ++id) {
4118 DEFINE_ADD_VALUE_F(id);
4119 }
4120 }
4121 {
4122 JSONArray internals(&map, "Double");
4123 DEFINE_ADD_VALUE_F_CID(Double);
4124 }
4125 {
4126 JSONArray internals(&map, "String");
4127 CLASS_LIST_STRINGS(DEFINE_ADD_VALUE_F_CID)
4128 }
4129 {
4130 JSONArray internals(&map, "List");
4131 CLASS_LIST_ARRAYS(DEFINE_ADD_VALUE_F_CID)
4132 DEFINE_ADD_VALUE_F_CID(GrowableObjectArray)
4133 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
4134 }
4135 {
4136 JSONArray internals(&map, "Map");
4137 DEFINE_ADD_VALUE_F_CID(LinkedHashMap)
4138 }
4139 #define DEFINE_ADD_MAP_KEY(clazz) \
4140 { \
4141 JSONArray internals(&map, #clazz); \
4142 DEFINE_ADD_VALUE_F_CID(TypedData##clazz) \
4143 DEFINE_ADD_VALUE_F_CID(TypedData##clazz) \
4144 DEFINE_ADD_VALUE_F_CID(ExternalTypedData##clazz) \
4145 }
4146 CLASS_LIST_TYPED_DATA(DEFINE_ADD_MAP_KEY)
4147 #undef DEFINE_ADD_MAP_KEY
4148 #undef DEFINE_ADD_VALUE_F_CID
4149 #undef DEFINE_ADD_VALUE_F
4150
4151 return true;
4152 }
4153
4080 // clang-format off 4154 // clang-format off
4081 static const ServiceMethodDescriptor service_methods_[] = { 4155 static const ServiceMethodDescriptor service_methods_[] = {
4082 { "_dumpIdZone", DumpIdZone, NULL }, 4156 { "_dumpIdZone", DumpIdZone, NULL },
4083 { "_echo", Echo, 4157 { "_echo", Echo,
4084 NULL }, 4158 NULL },
4085 { "_respondWithMalformedJson", RespondWithMalformedJson, 4159 { "_respondWithMalformedJson", RespondWithMalformedJson,
4086 NULL }, 4160 NULL },
4087 { "_respondWithMalformedObject", RespondWithMalformedObject, 4161 { "_respondWithMalformedObject", RespondWithMalformedObject,
4088 NULL }, 4162 NULL },
4089 { "_triggerEchoEvent", TriggerEchoEvent, 4163 { "_triggerEchoEvent", TriggerEchoEvent,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
4189 { "setName", SetName, 4263 { "setName", SetName,
4190 set_name_params }, 4264 set_name_params },
4191 { "_setTraceClassAllocation", SetTraceClassAllocation, 4265 { "_setTraceClassAllocation", SetTraceClassAllocation,
4192 set_trace_class_allocation_params }, 4266 set_trace_class_allocation_params },
4193 { "setVMName", SetVMName, 4267 { "setVMName", SetVMName,
4194 set_vm_name_params }, 4268 set_vm_name_params },
4195 { "_setVMTimelineFlags", SetVMTimelineFlags, 4269 { "_setVMTimelineFlags", SetVMTimelineFlags,
4196 set_vm_timeline_flags_params }, 4270 set_vm_timeline_flags_params },
4197 { "_collectAllGarbage", CollectAllGarbage, 4271 { "_collectAllGarbage", CollectAllGarbage,
4198 collect_all_garbage_params }, 4272 collect_all_garbage_params },
4273 { "_getDefaultClassesAliases", GetDefaultClassesAliases,
4274 get_default_classes_aliases_params },
4199 }; 4275 };
4200 // clang-format on 4276 // clang-format on
4201 4277
4202 const ServiceMethodDescriptor* FindMethod(const char* method_name) { 4278 const ServiceMethodDescriptor* FindMethod(const char* method_name) {
4203 intptr_t num_methods = sizeof(service_methods_) / sizeof(service_methods_[0]); 4279 intptr_t num_methods = sizeof(service_methods_) / sizeof(service_methods_[0]);
4204 for (intptr_t i = 0; i < num_methods; i++) { 4280 for (intptr_t i = 0; i < num_methods; i++) {
4205 const ServiceMethodDescriptor& method = service_methods_[i]; 4281 const ServiceMethodDescriptor& method = service_methods_[i];
4206 if (strcmp(method_name, method.name) == 0) { 4282 if (strcmp(method_name, method.name) == 0) {
4207 return &method; 4283 return &method;
4208 } 4284 }
4209 } 4285 }
4210 return NULL; 4286 return NULL;
4211 } 4287 }
4212 4288
4213 #endif // !PRODUCT 4289 #endif // !PRODUCT
4214 4290
4215 } // namespace dart 4291 } // 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