Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "include/dart_debugger_api.h" | 5 #include "include/dart_debugger_api.h" |
| 6 | 6 |
| 7 #include "vm/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
| 8 #include "vm/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
| 9 #include "vm/debugger.h" | 9 #include "vm/debugger.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 } | 491 } |
| 492 return Api::NewHandle(isolate, script_list.raw()); | 492 return Api::NewHandle(isolate, script_list.raw()); |
| 493 } | 493 } |
| 494 | 494 |
| 495 | 495 |
| 496 DART_EXPORT Dart_Handle Dart_GetLibraryURLs() { | 496 DART_EXPORT Dart_Handle Dart_GetLibraryURLs() { |
| 497 Isolate* isolate = Isolate::Current(); | 497 Isolate* isolate = Isolate::Current(); |
| 498 ASSERT(isolate != NULL); | 498 ASSERT(isolate != NULL); |
| 499 DARTSCOPE(isolate); | 499 DARTSCOPE(isolate); |
| 500 | 500 |
| 501 // Find out how many libraries are loaded in this isolate. | 501 const GrowableObjectArray& libs = |
| 502 int num_libs = 0; | 502 GrowableObjectArray::Handle(isolate->object_store()->libraries()); |
| 503 Library &lib = Library::Handle(); | 503 int num_libs = libs.Length(); |
| 504 lib = isolate->object_store()->registered_libraries(); | |
| 505 while (!lib.IsNull()) { | |
| 506 num_libs++; | |
| 507 lib = lib.next_registered(); | |
| 508 } | |
| 509 | 504 |
| 510 // Create new list and populate with the url of loaded libraries. | 505 // Create new list and populate with the url of loaded libraries. |
| 506 Library &lib = Library::Handle(); | |
| 507 String& lib_url = String::Handle(); | |
| 511 const Array& library_list = Array::Handle(Array::New(num_libs)); | 508 const Array& library_list = Array::Handle(Array::New(num_libs)); |
|
srdjan
2012/05/23 17:35:18
library_url_list ?
hausner
2012/05/23 20:27:14
Done.
| |
| 512 lib = isolate->object_store()->registered_libraries(); | |
| 513 String& lib_url = String::Handle(); | |
| 514 for (int i = 0; i < num_libs; i++) { | 509 for (int i = 0; i < num_libs; i++) { |
| 510 lib ^= libs.At(i); | |
| 515 ASSERT(!lib.IsNull()); | 511 ASSERT(!lib.IsNull()); |
| 516 lib_url = lib.url(); | 512 lib_url = lib.url(); |
| 517 library_list.SetAt(i, lib_url); | 513 library_list.SetAt(i, lib_url); |
| 518 lib = lib.next_registered(); | |
| 519 } | 514 } |
| 520 return Api::NewHandle(isolate, library_list.raw()); | 515 return Api::NewHandle(isolate, library_list.raw()); |
| 521 } | 516 } |
| 522 | 517 |
| 523 } // namespace dart | 518 } // namespace dart |
| OLD | NEW |