| OLD | NEW |
| 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 "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 | 9 |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2120 | 2120 |
| 2121 static const MethodParameter* get_tag_profile_params[] = { | 2121 static const MethodParameter* get_tag_profile_params[] = { |
| 2122 ISOLATE_PARAMETER, | 2122 ISOLATE_PARAMETER, |
| 2123 NULL, | 2123 NULL, |
| 2124 }; | 2124 }; |
| 2125 | 2125 |
| 2126 | 2126 |
| 2127 static bool GetTagProfile(Isolate* isolate, JSONStream* js) { | 2127 static bool GetTagProfile(Isolate* isolate, JSONStream* js) { |
| 2128 JSONObject miniProfile(js); | 2128 JSONObject miniProfile(js); |
| 2129 miniProfile.AddProperty("type", "TagProfile"); | 2129 miniProfile.AddProperty("type", "TagProfile"); |
| 2130 miniProfile.AddProperty("id", "profile/tag"); | |
| 2131 isolate->vm_tag_counters()->PrintToJSONObject(&miniProfile); | 2130 isolate->vm_tag_counters()->PrintToJSONObject(&miniProfile); |
| 2132 return true; | 2131 return true; |
| 2133 } | 2132 } |
| 2134 | 2133 |
| 2135 | 2134 |
| 2136 static const char* tags_enum_names[] = { | 2135 static const char* tags_enum_names[] = { |
| 2137 "None", | 2136 "None", |
| 2138 "UserVM", | 2137 "UserVM", |
| 2139 "UserOnly", | 2138 "UserOnly", |
| 2140 "VMUser", | 2139 "VMUser", |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2236 ISOLATE_PARAMETER, | 2235 ISOLATE_PARAMETER, |
| 2237 NULL, | 2236 NULL, |
| 2238 }; | 2237 }; |
| 2239 | 2238 |
| 2240 | 2239 |
| 2241 static bool RequestHeapSnapshot(Isolate* isolate, JSONStream* js) { | 2240 static bool RequestHeapSnapshot(Isolate* isolate, JSONStream* js) { |
| 2242 Service::SendGraphEvent(isolate); | 2241 Service::SendGraphEvent(isolate); |
| 2243 // TODO(koda): Provide some id that ties this request to async response(s). | 2242 // TODO(koda): Provide some id that ties this request to async response(s). |
| 2244 JSONObject jsobj(js); | 2243 JSONObject jsobj(js); |
| 2245 jsobj.AddProperty("type", "OK"); | 2244 jsobj.AddProperty("type", "OK"); |
| 2246 jsobj.AddProperty("id", "ok"); | |
| 2247 return true; | 2245 return true; |
| 2248 } | 2246 } |
| 2249 | 2247 |
| 2250 | 2248 |
| 2251 void Service::SendGraphEvent(Isolate* isolate) { | 2249 void Service::SendGraphEvent(Isolate* isolate) { |
| 2252 uint8_t* buffer = NULL; | 2250 uint8_t* buffer = NULL; |
| 2253 WriteStream stream(&buffer, &allocator, 1 * MB); | 2251 WriteStream stream(&buffer, &allocator, 1 * MB); |
| 2254 ObjectGraph graph(isolate); | 2252 ObjectGraph graph(isolate); |
| 2255 intptr_t node_count = graph.Serialize(&stream); | 2253 intptr_t node_count = graph.Serialize(&stream); |
| 2256 | 2254 |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2666 ServiceMethodDescriptor& method = service_methods_[i]; | 2664 ServiceMethodDescriptor& method = service_methods_[i]; |
| 2667 if (strcmp(method_name, method.name) == 0) { | 2665 if (strcmp(method_name, method.name) == 0) { |
| 2668 return &method; | 2666 return &method; |
| 2669 } | 2667 } |
| 2670 } | 2668 } |
| 2671 return NULL; | 2669 return NULL; |
| 2672 } | 2670 } |
| 2673 | 2671 |
| 2674 | 2672 |
| 2675 } // namespace dart | 2673 } // namespace dart |
| OLD | NEW |