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

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

Issue 1477573002: Remove Field::FindFieldIndex() and update service protocol (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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/vm/object_test.cc ('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 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 return Object::sentinel().raw(); 1264 return Object::sentinel().raw();
1265 } 1265 }
1266 Function& func = Function::Handle(zone); 1266 Function& func = Function::Handle(zone);
1267 func ^= isolate->ClosureFunctionFromIndex(id); 1267 func ^= isolate->ClosureFunctionFromIndex(id);
1268 if (func.IsNull()) { 1268 if (func.IsNull()) {
1269 return Object::sentinel().raw(); 1269 return Object::sentinel().raw();
1270 } 1270 }
1271 return func.raw(); 1271 return func.raw();
1272 1272
1273 } else if (strcmp(parts[2], "fields") == 0) { 1273 } else if (strcmp(parts[2], "fields") == 0) {
1274 // Field ids look like: "classes/17/fields/11" 1274 // Field ids look like: "classes/17/fields/name"
1275 if (num_parts != 4) { 1275 if (num_parts != 4) {
1276 return Object::sentinel().raw(); 1276 return Object::sentinel().raw();
1277 } 1277 }
1278 intptr_t id; 1278 const char* encoded_id = parts[3];
1279 if (!GetIntegerId(parts[3], &id)) { 1279 String& id = String::Handle(zone, String::New(encoded_id));
1280 id = String::DecodeIRI(id);
1281 if (id.IsNull()) {
1280 return Object::sentinel().raw(); 1282 return Object::sentinel().raw();
1281 } 1283 }
1282 Field& field = Field::Handle(zone, cls.FieldFromIndex(id)); 1284 Field& field = Field::Handle(zone, cls.LookupField(id));
1283 if (field.IsNull()) { 1285 if (field.IsNull()) {
1284 return Object::sentinel().raw(); 1286 return Object::sentinel().raw();
1285 } 1287 }
1286 return field.raw(); 1288 return field.raw();
1287 1289
1288 } else if (strcmp(parts[2], "functions") == 0) { 1290 } else if (strcmp(parts[2], "functions") == 0) {
1289 // Function ids look like: "classes/17/functions/11" 1291 // Function ids look like: "classes/17/functions/name"
1290 if (num_parts != 4) { 1292 if (num_parts != 4) {
1291 return Object::sentinel().raw(); 1293 return Object::sentinel().raw();
1292 } 1294 }
1293 const char* encoded_id = parts[3]; 1295 const char* encoded_id = parts[3];
1294 String& id = String::Handle(zone, String::New(encoded_id)); 1296 String& id = String::Handle(zone, String::New(encoded_id));
1295 id = String::DecodeIRI(id); 1297 id = String::DecodeIRI(id);
1296 if (id.IsNull()) { 1298 if (id.IsNull()) {
1297 return Object::sentinel().raw(); 1299 return Object::sentinel().raw();
1298 } 1300 }
1299 Function& func = Function::Handle(zone, cls.LookupFunction(id)); 1301 Function& func = Function::Handle(zone, cls.LookupFunction(id));
(...skipping 2253 matching lines...) Expand 10 before | Expand all | Expand 10 after
3553 const ServiceMethodDescriptor& method = service_methods_[i]; 3555 const ServiceMethodDescriptor& method = service_methods_[i];
3554 if (strcmp(method_name, method.name) == 0) { 3556 if (strcmp(method_name, method.name) == 0) {
3555 return &method; 3557 return &method;
3556 } 3558 }
3557 } 3559 }
3558 return NULL; 3560 return NULL;
3559 } 3561 }
3560 3562
3561 3563
3562 } // namespace dart 3564 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698