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

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

Issue 466183002: Use function names as service IDs, rather than indices. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/service_test.cc » ('j') | 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 "platform/globals.h" 8 #include "platform/globals.h"
9 9
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 static bool HandleClassesFunctionsCoverage( 1132 static bool HandleClassesFunctionsCoverage(
1133 Isolate* isolate, const Function& func, JSONStream* js) { 1133 Isolate* isolate, const Function& func, JSONStream* js) {
1134 FunctionCoverageFilter filter(func); 1134 FunctionCoverageFilter filter(func);
1135 CodeCoverage::PrintJSON(isolate, js, &filter); 1135 CodeCoverage::PrintJSON(isolate, js, &filter);
1136 return true; 1136 return true;
1137 } 1137 }
1138 1138
1139 1139
1140 static bool HandleClassesFunctions(Isolate* isolate, const Class& cls, 1140 static bool HandleClassesFunctions(Isolate* isolate, const Class& cls,
1141 JSONStream* js) { 1141 JSONStream* js) {
1142 intptr_t id; 1142 if (js->num_arguments() != 4 && js->num_arguments() != 5) {
1143 if (js->num_arguments() > 5) { 1143 PrintError(js, "Command should have 4 or 5 arguments");
1144 PrintError(js, "Command too long");
1145 return true; 1144 return true;
1146 } 1145 }
1147 if (!GetIntegerId(js->GetArgument(3), &id)) { 1146 String& id = String::Handle(isolate, String::New(js->GetArgument(3)));
1148 PrintError(js, "Must specify collection object id: functions/id"); 1147 id = String::DecodeIRI(id);
1149 return true; 1148 Function& func = Function::Handle(cls.LookupFunction(id));
1150 }
1151 Function& func = Function::Handle();
1152 func ^= cls.FunctionFromIndex(id);
1153 if (func.IsNull()) { 1149 if (func.IsNull()) {
1154 PrintError(js, "Function %" Pd " not found", id); 1150 PrintError(js, "Function %s not found", id.ToCString());
Cutch 2014/08/13 18:01:47 Should we report the undecoded id (so that it matc
koda 2014/08/13 18:18:35 Good idea; changed to report the id from the reque
1155 return true; 1151 return true;
1156 } 1152 }
1157 if (js->num_arguments() == 4) { 1153 if (js->num_arguments() == 4) {
1158 func.PrintJSON(js, false); 1154 func.PrintJSON(js, false);
1159 return true; 1155 return true;
1160 } else { 1156 } else {
1161 const char* subcollection = js->GetArgument(4); 1157 const char* subcollection = js->GetArgument(4);
1162 if (strcmp(subcollection, "coverage") == 0) { 1158 if (strcmp(subcollection, "coverage") == 0) {
1163 return HandleClassesFunctionsCoverage(isolate, func, js); 1159 return HandleClassesFunctionsCoverage(isolate, func, js);
1164 } else { 1160 } else {
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
2524 while (current != NULL) { 2520 while (current != NULL) {
2525 if (strcmp(name, current->name()) == 0) { 2521 if (strcmp(name, current->name()) == 0) {
2526 return current; 2522 return current;
2527 } 2523 }
2528 current = current->next(); 2524 current = current->next();
2529 } 2525 }
2530 return NULL; 2526 return NULL;
2531 } 2527 }
2532 2528
2533 } // namespace dart 2529 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/service_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698