| 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 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2108 jsobj.AddProperty("id", "instance_set"); | 2108 jsobj.AddProperty("id", "instance_set"); |
| 2109 jsobj.AddProperty("totalCount", count); | 2109 jsobj.AddProperty("totalCount", count); |
| 2110 jsobj.AddProperty("sampleCount", storage.Length()); | 2110 jsobj.AddProperty("sampleCount", storage.Length()); |
| 2111 jsobj.AddProperty("sample", storage); | 2111 jsobj.AddProperty("sample", storage); |
| 2112 return true; | 2112 return true; |
| 2113 } | 2113 } |
| 2114 | 2114 |
| 2115 | 2115 |
| 2116 static bool HandleClasses(Isolate* isolate, JSONStream* js) { | 2116 static bool HandleClasses(Isolate* isolate, JSONStream* js) { |
| 2117 if (js->num_arguments() == 1) { | 2117 if (js->num_arguments() == 1) { |
| 2118 ClassTable* table = isolate->class_table(); | 2118 PrintError(js, "Invalid number of arguments."); |
| 2119 JSONObject jsobj(js); | |
| 2120 table->PrintToJSONObject(&jsobj); | |
| 2121 return true; | 2119 return true; |
| 2122 } | 2120 } |
| 2123 ASSERT(js->num_arguments() >= 2); | 2121 ASSERT(js->num_arguments() >= 2); |
| 2124 intptr_t id; | 2122 intptr_t id; |
| 2125 if (!GetIntegerId(js->GetArgument(1), &id)) { | 2123 if (!GetIntegerId(js->GetArgument(1), &id)) { |
| 2126 PrintError(js, "Must specify collection object id: /classes/id"); | 2124 PrintError(js, "Must specify collection object id: /classes/id"); |
| 2127 return true; | 2125 return true; |
| 2128 } | 2126 } |
| 2129 ClassTable* table = isolate->class_table(); | 2127 ClassTable* table = isolate->class_table(); |
| 2130 if (!table->IsValidIndex(id)) { | 2128 if (!table->IsValidIndex(id)) { |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2938 if (bpt != NULL) { | 2936 if (bpt != NULL) { |
| 2939 bpt->PrintJSON(js); | 2937 bpt->PrintJSON(js); |
| 2940 return true; | 2938 return true; |
| 2941 } | 2939 } |
| 2942 | 2940 |
| 2943 PrintError(js, "Unrecognized object id: %s\n", id); | 2941 PrintError(js, "Unrecognized object id: %s\n", id); |
| 2944 return true; | 2942 return true; |
| 2945 } | 2943 } |
| 2946 | 2944 |
| 2947 | 2945 |
| 2946 static bool HandleIsolateGetClassList(Isolate* isolate, JSONStream* js) { |
| 2947 ClassTable* table = isolate->class_table(); |
| 2948 JSONObject jsobj(js); |
| 2949 table->PrintToJSONObject(&jsobj); |
| 2950 return true; |
| 2951 } |
| 2952 |
| 2953 |
| 2948 static IsolateMessageHandlerEntry isolate_handlers_new[] = { | 2954 static IsolateMessageHandlerEntry isolate_handlers_new[] = { |
| 2949 { "getObject", HandleIsolateGetObject }, | 2955 { "getObject", HandleIsolateGetObject }, |
| 2950 { "getBreakpoints", HandleIsolateGetBreakpoints }, | 2956 { "getBreakpoints", HandleIsolateGetBreakpoints }, |
| 2951 { "pause", HandleIsolatePause }, | 2957 { "pause", HandleIsolatePause }, |
| 2952 { "resume", HandleIsolateResume }, | 2958 { "resume", HandleIsolateResume }, |
| 2953 { "getStack", HandleIsolateGetStack }, | 2959 { "getStack", HandleIsolateGetStack }, |
| 2954 { "getCpuProfile", HandleIsolateGetCpuProfile }, | 2960 { "getCpuProfile", HandleIsolateGetCpuProfile }, |
| 2955 { "getTagProfile", HandleIsolateGetTagProfile }, | 2961 { "getTagProfile", HandleIsolateGetTagProfile }, |
| 2956 { "getAllocationProfile", HandleIsolateGetAllocationProfile }, | 2962 { "getAllocationProfile", HandleIsolateGetAllocationProfile }, |
| 2957 { "getHeapMap", HandleIsolateGetHeapMap }, | 2963 { "getHeapMap", HandleIsolateGetHeapMap }, |
| 2958 { "addBreakpoint", HandleIsolateAddBreakpoint }, | 2964 { "addBreakpoint", HandleIsolateAddBreakpoint }, |
| 2959 { "removeBreakpoint", HandleIsolateRemoveBreakpoint }, | 2965 { "removeBreakpoint", HandleIsolateRemoveBreakpoint }, |
| 2960 { "getCoverage", HandleIsolateGetCoverage }, | 2966 { "getCoverage", HandleIsolateGetCoverage }, |
| 2961 { "eval", HandleIsolateEval }, | 2967 { "eval", HandleIsolateEval }, |
| 2962 { "getRetainedSize", HandleIsolateGetRetainedSize }, | 2968 { "getRetainedSize", HandleIsolateGetRetainedSize }, |
| 2963 { "getRetainingPath", HandleIsolateGetRetainingPath }, | 2969 { "getRetainingPath", HandleIsolateGetRetainingPath }, |
| 2964 { "getInboundReferences", HandleIsolateGetInboundReferences }, | 2970 { "getInboundReferences", HandleIsolateGetInboundReferences }, |
| 2965 { "getInstances", HandleIsolateGetInstances }, | 2971 { "getInstances", HandleIsolateGetInstances }, |
| 2966 { "requestHeapSnapshot", HandleIsolateRequestHeapSnapshot }, | 2972 { "requestHeapSnapshot", HandleIsolateRequestHeapSnapshot }, |
| 2973 { "getClassList", HandleIsolateGetClassList }, |
| 2967 }; | 2974 }; |
| 2968 | 2975 |
| 2969 | 2976 |
| 2970 static IsolateMessageHandler FindIsolateMessageHandlerNew(const char* command) { | 2977 static IsolateMessageHandler FindIsolateMessageHandlerNew(const char* command) { |
| 2971 intptr_t num_message_handlers = sizeof(isolate_handlers_new) / | 2978 intptr_t num_message_handlers = sizeof(isolate_handlers_new) / |
| 2972 sizeof(isolate_handlers_new[0]); | 2979 sizeof(isolate_handlers_new[0]); |
| 2973 for (intptr_t i = 0; i < num_message_handlers; i++) { | 2980 for (intptr_t i = 0; i < num_message_handlers; i++) { |
| 2974 const IsolateMessageHandlerEntry& entry = isolate_handlers_new[i]; | 2981 const IsolateMessageHandlerEntry& entry = isolate_handlers_new[i]; |
| 2975 if (strcmp(command, entry.command) == 0) { | 2982 if (strcmp(command, entry.command) == 0) { |
| 2976 return entry.handler; | 2983 return entry.handler; |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3336 while (current != NULL) { | 3343 while (current != NULL) { |
| 3337 if (strcmp(name, current->name()) == 0) { | 3344 if (strcmp(name, current->name()) == 0) { |
| 3338 return current; | 3345 return current; |
| 3339 } | 3346 } |
| 3340 current = current->next(); | 3347 current = current->next(); |
| 3341 } | 3348 } |
| 3342 return NULL; | 3349 return NULL; |
| 3343 } | 3350 } |
| 3344 | 3351 |
| 3345 } // namespace dart | 3352 } // namespace dart |
| OLD | NEW |