| 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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 return Api::NewError("%s: library '%s' not found", | 567 return Api::NewError("%s: library '%s' not found", |
| 568 CURRENT_FUNC, library_url.ToCString()); | 568 CURRENT_FUNC, library_url.ToCString()); |
| 569 } | 569 } |
| 570 const Array& loaded_scripts = Array::Handle(library.LoadedScripts()); | 570 const Array& loaded_scripts = Array::Handle(library.LoadedScripts()); |
| 571 ASSERT(!loaded_scripts.IsNull()); | 571 ASSERT(!loaded_scripts.IsNull()); |
| 572 intptr_t num_scripts = loaded_scripts.Length(); | 572 intptr_t num_scripts = loaded_scripts.Length(); |
| 573 const Array& script_list = Array::Handle(Array::New(num_scripts)); | 573 const Array& script_list = Array::Handle(Array::New(num_scripts)); |
| 574 Script& script = Script::Handle(); | 574 Script& script = Script::Handle(); |
| 575 String& url = String::Handle(); | 575 String& url = String::Handle(); |
| 576 for (int i = 0; i < num_scripts; i++) { | 576 for (int i = 0; i < num_scripts; i++) { |
| 577 script ^= loaded_scripts.At(i); | 577 script |= loaded_scripts.At(i); |
| 578 url = script.url(); | 578 url = script.url(); |
| 579 script_list.SetAt(i, url); | 579 script_list.SetAt(i, url); |
| 580 } | 580 } |
| 581 return Api::NewHandle(isolate, script_list.raw()); | 581 return Api::NewHandle(isolate, script_list.raw()); |
| 582 } | 582 } |
| 583 | 583 |
| 584 | 584 |
| 585 DART_EXPORT Dart_Handle Dart_GetLibraryIds() { | 585 DART_EXPORT Dart_Handle Dart_GetLibraryIds() { |
| 586 Isolate* isolate = Isolate::Current(); | 586 Isolate* isolate = Isolate::Current(); |
| 587 ASSERT(isolate != NULL); | 587 ASSERT(isolate != NULL); |
| 588 DARTSCOPE(isolate); | 588 DARTSCOPE(isolate); |
| 589 | 589 |
| 590 const GrowableObjectArray& libs = | 590 const GrowableObjectArray& libs = |
| 591 GrowableObjectArray::Handle(isolate->object_store()->libraries()); | 591 GrowableObjectArray::Handle(isolate->object_store()->libraries()); |
| 592 int num_libs = libs.Length(); | 592 int num_libs = libs.Length(); |
| 593 | 593 |
| 594 // Create new list and populate with the url of loaded libraries. | 594 // Create new list and populate with the url of loaded libraries. |
| 595 Library &lib = Library::Handle(); | 595 Library &lib = Library::Handle(); |
| 596 const Array& library_id_list = Array::Handle(Array::New(num_libs)); | 596 const Array& library_id_list = Array::Handle(Array::New(num_libs)); |
| 597 for (int i = 0; i < num_libs; i++) { | 597 for (int i = 0; i < num_libs; i++) { |
| 598 lib ^= libs.At(i); | 598 lib |= libs.At(i); |
| 599 ASSERT(!lib.IsNull()); | 599 ASSERT(!lib.IsNull()); |
| 600 ASSERT(Smi::IsValid(lib.index())); | 600 ASSERT(Smi::IsValid(lib.index())); |
| 601 library_id_list.SetAt(i, Smi::Handle(Smi::New(lib.index()))); | 601 library_id_list.SetAt(i, Smi::Handle(Smi::New(lib.index()))); |
| 602 } | 602 } |
| 603 return Api::NewHandle(isolate, library_id_list.raw()); | 603 return Api::NewHandle(isolate, library_id_list.raw()); |
| 604 } | 604 } |
| 605 | 605 |
| 606 | 606 |
| 607 DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) { | 607 DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) { |
| 608 Isolate* isolate = Isolate::Current(); | 608 Isolate* isolate = Isolate::Current(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 | 663 |
| 664 const GrowableObjectArray& libs = | 664 const GrowableObjectArray& libs = |
| 665 GrowableObjectArray::Handle(isolate->object_store()->libraries()); | 665 GrowableObjectArray::Handle(isolate->object_store()->libraries()); |
| 666 int num_libs = libs.Length(); | 666 int num_libs = libs.Length(); |
| 667 | 667 |
| 668 // Create new list and populate with the url of loaded libraries. | 668 // Create new list and populate with the url of loaded libraries. |
| 669 Library &lib = Library::Handle(); | 669 Library &lib = Library::Handle(); |
| 670 String& lib_url = String::Handle(); | 670 String& lib_url = String::Handle(); |
| 671 const Array& library_url_list = Array::Handle(Array::New(num_libs)); | 671 const Array& library_url_list = Array::Handle(Array::New(num_libs)); |
| 672 for (int i = 0; i < num_libs; i++) { | 672 for (int i = 0; i < num_libs; i++) { |
| 673 lib ^= libs.At(i); | 673 lib |= libs.At(i); |
| 674 ASSERT(!lib.IsNull()); | 674 ASSERT(!lib.IsNull()); |
| 675 lib_url = lib.url(); | 675 lib_url = lib.url(); |
| 676 library_url_list.SetAt(i, lib_url); | 676 library_url_list.SetAt(i, lib_url); |
| 677 } | 677 } |
| 678 return Api::NewHandle(isolate, library_url_list.raw()); | 678 return Api::NewHandle(isolate, library_url_list.raw()); |
| 679 } | 679 } |
| 680 | 680 |
| 681 | 681 |
| 682 DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, | 682 DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, |
| 683 bool* is_debuggable) { | 683 bool* is_debuggable) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 709 return Api::True(isolate); | 709 return Api::True(isolate); |
| 710 } | 710 } |
| 711 | 711 |
| 712 | 712 |
| 713 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) { | 713 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) { |
| 714 Isolate* isolate = PortMap::GetIsolate(isolate_id); | 714 Isolate* isolate = PortMap::GetIsolate(isolate_id); |
| 715 return Api::CastIsolate(isolate); | 715 return Api::CastIsolate(isolate); |
| 716 } | 716 } |
| 717 | 717 |
| 718 } // namespace dart | 718 } // namespace dart |
| OLD | NEW |