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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 return Api::NewError("%s: library '%s' not found", | 603 return Api::NewError("%s: library '%s' not found", |
604 CURRENT_FUNC, library_url.ToCString()); | 604 CURRENT_FUNC, library_url.ToCString()); |
605 } | 605 } |
606 const Array& loaded_scripts = Array::Handle(library.LoadedScripts()); | 606 const Array& loaded_scripts = Array::Handle(library.LoadedScripts()); |
607 ASSERT(!loaded_scripts.IsNull()); | 607 ASSERT(!loaded_scripts.IsNull()); |
608 intptr_t num_scripts = loaded_scripts.Length(); | 608 intptr_t num_scripts = loaded_scripts.Length(); |
609 const Array& script_list = Array::Handle(Array::New(num_scripts)); | 609 const Array& script_list = Array::Handle(Array::New(num_scripts)); |
610 Script& script = Script::Handle(); | 610 Script& script = Script::Handle(); |
611 String& url = String::Handle(); | 611 String& url = String::Handle(); |
612 for (int i = 0; i < num_scripts; i++) { | 612 for (int i = 0; i < num_scripts; i++) { |
613 script |= loaded_scripts.At(i); | 613 script ^= loaded_scripts.At(i); |
614 url = script.url(); | 614 url = script.url(); |
615 script_list.SetAt(i, url); | 615 script_list.SetAt(i, url); |
616 } | 616 } |
617 return Api::NewHandle(isolate, script_list.raw()); | 617 return Api::NewHandle(isolate, script_list.raw()); |
618 } | 618 } |
619 | 619 |
620 | 620 |
621 DART_EXPORT Dart_Handle Dart_GetLibraryIds() { | 621 DART_EXPORT Dart_Handle Dart_GetLibraryIds() { |
622 Isolate* isolate = Isolate::Current(); | 622 Isolate* isolate = Isolate::Current(); |
623 ASSERT(isolate != NULL); | 623 ASSERT(isolate != NULL); |
624 DARTSCOPE(isolate); | 624 DARTSCOPE(isolate); |
625 | 625 |
626 const GrowableObjectArray& libs = | 626 const GrowableObjectArray& libs = |
627 GrowableObjectArray::Handle(isolate->object_store()->libraries()); | 627 GrowableObjectArray::Handle(isolate->object_store()->libraries()); |
628 int num_libs = libs.Length(); | 628 int num_libs = libs.Length(); |
629 | 629 |
630 // Create new list and populate with the url of loaded libraries. | 630 // Create new list and populate with the url of loaded libraries. |
631 Library &lib = Library::Handle(); | 631 Library &lib = Library::Handle(); |
632 const Array& library_id_list = Array::Handle(Array::New(num_libs)); | 632 const Array& library_id_list = Array::Handle(Array::New(num_libs)); |
633 for (int i = 0; i < num_libs; i++) { | 633 for (int i = 0; i < num_libs; i++) { |
634 lib |= libs.At(i); | 634 lib ^= libs.At(i); |
635 ASSERT(!lib.IsNull()); | 635 ASSERT(!lib.IsNull()); |
636 ASSERT(Smi::IsValid(lib.index())); | 636 ASSERT(Smi::IsValid(lib.index())); |
637 library_id_list.SetAt(i, Smi::Handle(Smi::New(lib.index()))); | 637 library_id_list.SetAt(i, Smi::Handle(Smi::New(lib.index()))); |
638 } | 638 } |
639 return Api::NewHandle(isolate, library_id_list.raw()); | 639 return Api::NewHandle(isolate, library_id_list.raw()); |
640 } | 640 } |
641 | 641 |
642 | 642 |
643 DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) { | 643 DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) { |
644 Isolate* isolate = Isolate::Current(); | 644 Isolate* isolate = Isolate::Current(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 | 699 |
700 const GrowableObjectArray& libs = | 700 const GrowableObjectArray& libs = |
701 GrowableObjectArray::Handle(isolate->object_store()->libraries()); | 701 GrowableObjectArray::Handle(isolate->object_store()->libraries()); |
702 int num_libs = libs.Length(); | 702 int num_libs = libs.Length(); |
703 | 703 |
704 // Create new list and populate with the url of loaded libraries. | 704 // Create new list and populate with the url of loaded libraries. |
705 Library &lib = Library::Handle(); | 705 Library &lib = Library::Handle(); |
706 String& lib_url = String::Handle(); | 706 String& lib_url = String::Handle(); |
707 const Array& library_url_list = Array::Handle(Array::New(num_libs)); | 707 const Array& library_url_list = Array::Handle(Array::New(num_libs)); |
708 for (int i = 0; i < num_libs; i++) { | 708 for (int i = 0; i < num_libs; i++) { |
709 lib |= libs.At(i); | 709 lib ^= libs.At(i); |
710 ASSERT(!lib.IsNull()); | 710 ASSERT(!lib.IsNull()); |
711 lib_url = lib.url(); | 711 lib_url = lib.url(); |
712 library_url_list.SetAt(i, lib_url); | 712 library_url_list.SetAt(i, lib_url); |
713 } | 713 } |
714 return Api::NewHandle(isolate, library_url_list.raw()); | 714 return Api::NewHandle(isolate, library_url_list.raw()); |
715 } | 715 } |
716 | 716 |
717 | 717 |
718 DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, | 718 DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id, |
719 bool* is_debuggable) { | 719 bool* is_debuggable) { |
(...skipping 25 matching lines...) Expand all Loading... |
745 return Api::True(isolate); | 745 return Api::True(isolate); |
746 } | 746 } |
747 | 747 |
748 | 748 |
749 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) { | 749 DART_EXPORT Dart_Isolate Dart_GetIsolate(Dart_IsolateId isolate_id) { |
750 Isolate* isolate = PortMap::GetIsolate(isolate_id); | 750 Isolate* isolate = PortMap::GetIsolate(isolate_id); |
751 return Api::CastIsolate(isolate); | 751 return Api::CastIsolate(isolate); |
752 } | 752 } |
753 | 753 |
754 } // namespace dart | 754 } // namespace dart |
OLD | NEW |