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/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
8 #include "vm/compiler.h" | 8 #include "vm/compiler.h" |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_api_state.h" | 10 #include "vm/dart_api_state.h" |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 DARTSCOPE(isolate); | 789 DARTSCOPE(isolate); |
790 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); | 790 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
791 if (lib.IsNull()) { | 791 if (lib.IsNull()) { |
792 return Api::NewError("%s: %" Pd " is not a valid library id", | 792 return Api::NewError("%s: %" Pd " is not a valid library id", |
793 CURRENT_FUNC, library_id); | 793 CURRENT_FUNC, library_id); |
794 } | 794 } |
795 return Api::NewHandle(isolate, lib.raw()); | 795 return Api::NewHandle(isolate, lib.raw()); |
796 } | 796 } |
797 | 797 |
798 | 798 |
| 799 DART_EXPORT Dart_Handle Dart_LibraryId(Dart_Handle library, |
| 800 intptr_t* library_id) { |
| 801 Isolate* isolate = Isolate::Current(); |
| 802 DARTSCOPE(isolate); |
| 803 const Library& lib = Api::UnwrapLibraryHandle(isolate, library); |
| 804 if (lib.IsNull()) { |
| 805 RETURN_TYPE_ERROR(isolate, library, Library); |
| 806 } |
| 807 if (library_id == NULL) { |
| 808 RETURN_NULL_ERROR(library_id); |
| 809 } |
| 810 *library_id = lib.index(); |
| 811 return Api::Success(); |
| 812 } |
| 813 |
| 814 |
799 DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) { | 815 DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) { |
800 Isolate* isolate = Isolate::Current(); | 816 Isolate* isolate = Isolate::Current(); |
801 ASSERT(isolate != NULL); | 817 ASSERT(isolate != NULL); |
802 DARTSCOPE(isolate); | 818 DARTSCOPE(isolate); |
803 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); | 819 const Library& lib = Library::Handle(Library::GetLibrary(library_id)); |
804 if (lib.IsNull()) { | 820 if (lib.IsNull()) { |
805 return Api::NewError("%s: %" Pd " is not a valid library id", | 821 return Api::NewError("%s: %" Pd " is not a valid library id", |
806 CURRENT_FUNC, library_id); | 822 CURRENT_FUNC, library_id); |
807 } | 823 } |
808 const GrowableObjectArray& import_list = | 824 const GrowableObjectArray& import_list = |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 | 902 |
887 | 903 |
888 DART_EXPORT char* Dart_GetVmStatus(const char* request) { | 904 DART_EXPORT char* Dart_GetVmStatus(const char* request) { |
889 if (strncmp(request, "/isolate/", 9) == 0) { | 905 if (strncmp(request, "/isolate/", 9) == 0) { |
890 return Isolate::GetStatus(request); | 906 return Isolate::GetStatus(request); |
891 } | 907 } |
892 return NULL; | 908 return NULL; |
893 } | 909 } |
894 | 910 |
895 } // namespace dart | 911 } // namespace dart |
OLD | NEW |