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 "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 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 static RawObject* LookupHeapObjectLibraries(Isolate* isolate, | 1508 static RawObject* LookupHeapObjectLibraries(Isolate* isolate, |
1509 char** parts, | 1509 char** parts, |
1510 int num_parts) { | 1510 int num_parts) { |
1511 // Library ids look like "libraries/35" | 1511 // Library ids look like "libraries/35" |
1512 if (num_parts < 2) { | 1512 if (num_parts < 2) { |
1513 return Object::sentinel().raw(); | 1513 return Object::sentinel().raw(); |
1514 } | 1514 } |
1515 const GrowableObjectArray& libs = | 1515 const GrowableObjectArray& libs = |
1516 GrowableObjectArray::Handle(isolate->object_store()->libraries()); | 1516 GrowableObjectArray::Handle(isolate->object_store()->libraries()); |
1517 ASSERT(!libs.IsNull()); | 1517 ASSERT(!libs.IsNull()); |
1518 intptr_t id = 0; | 1518 const String& id = String::Handle(String::New(parts[1])); |
1519 if (!GetIntegerId(parts[1], &id)) { | 1519 // Scan for private key. |
| 1520 String& private_key = String::Handle(); |
| 1521 Library& lib = Library::Handle(); |
| 1522 bool lib_found = false; |
| 1523 for (intptr_t i = 0; i < libs.Length(); i++) { |
| 1524 lib ^= libs.At(i); |
| 1525 ASSERT(!lib.IsNull()); |
| 1526 private_key ^= lib.private_key(); |
| 1527 if (private_key.Equals(id)) { |
| 1528 lib_found = true; |
| 1529 break; |
| 1530 } |
| 1531 } |
| 1532 if (!lib_found) { |
1520 return Object::sentinel().raw(); | 1533 return Object::sentinel().raw(); |
1521 } | 1534 } |
1522 if ((id < 0) || (id >= libs.Length())) { | |
1523 return Object::sentinel().raw(); | |
1524 } | |
1525 Library& lib = Library::Handle(); | |
1526 lib ^= libs.At(id); | |
1527 ASSERT(!lib.IsNull()); | |
1528 if (num_parts == 2) { | 1535 if (num_parts == 2) { |
1529 return lib.raw(); | 1536 return lib.raw(); |
1530 } | 1537 } |
1531 if (strcmp(parts[2], "scripts") == 0) { | 1538 if (strcmp(parts[2], "scripts") == 0) { |
1532 // Script ids look like "libraries/35/scripts/library%2Furl.dart/12345" | 1539 // Script ids look like "libraries/35/scripts/library%2Furl.dart/12345" |
1533 if (num_parts != 5) { | 1540 if (num_parts != 5) { |
1534 return Object::sentinel().raw(); | 1541 return Object::sentinel().raw(); |
1535 } | 1542 } |
1536 const String& id = String::Handle(String::New(parts[3])); | 1543 const String& id = String::Handle(String::New(parts[3])); |
1537 ASSERT(!id.IsNull()); | 1544 ASSERT(!id.IsNull()); |
(...skipping 2606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4144 if (strcmp(method_name, method.name) == 0) { | 4151 if (strcmp(method_name, method.name) == 0) { |
4145 return &method; | 4152 return &method; |
4146 } | 4153 } |
4147 } | 4154 } |
4148 return NULL; | 4155 return NULL; |
4149 } | 4156 } |
4150 | 4157 |
4151 #endif // !PRODUCT | 4158 #endif // !PRODUCT |
4152 | 4159 |
4153 } // namespace dart | 4160 } // namespace dart |
OLD | NEW |