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_tools_api.h" | 5 #include "include/dart_tools_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 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 return Api::NewHandle(T, Array::MakeArray(info)); | 782 return Api::NewHandle(T, Array::MakeArray(info)); |
783 } | 783 } |
784 | 784 |
785 | 785 |
786 DART_EXPORT Dart_Handle Dart_GenerateScriptSource(Dart_Handle library_url_in, | 786 DART_EXPORT Dart_Handle Dart_GenerateScriptSource(Dart_Handle library_url_in, |
787 Dart_Handle script_url_in) { | 787 Dart_Handle script_url_in) { |
788 DARTSCOPE(Thread::Current()); | 788 DARTSCOPE(Thread::Current()); |
789 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); | 789 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); |
790 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); | 790 UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in); |
791 | 791 |
792 const Library& library = Library::Handle(Library::LookupLibrary(library_url)); | 792 const Library& library = Library::Handle(Z, |
| 793 Library::LookupLibrary(T, library_url)); |
793 if (library.IsNull()) { | 794 if (library.IsNull()) { |
794 return Api::NewError("%s: library '%s' not found", | 795 return Api::NewError("%s: library '%s' not found", |
795 CURRENT_FUNC, library_url.ToCString()); | 796 CURRENT_FUNC, library_url.ToCString()); |
796 } | 797 } |
797 | 798 |
798 const Script& script = Script::Handle(library.LookupScript(script_url)); | 799 const Script& script = Script::Handle(Z, library.LookupScript(script_url)); |
799 if (script.IsNull()) { | 800 if (script.IsNull()) { |
800 return Api::NewError("%s: script '%s' not found in library '%s'", | 801 return Api::NewError("%s: script '%s' not found in library '%s'", |
801 CURRENT_FUNC, script_url.ToCString(), | 802 CURRENT_FUNC, script_url.ToCString(), |
802 library_url.ToCString()); | 803 library_url.ToCString()); |
803 } | 804 } |
804 | 805 |
805 return Api::NewHandle(T, script.GenerateSource()); | 806 return Api::NewHandle(T, script.GenerateSource()); |
806 } | 807 } |
807 | 808 |
808 | 809 |
809 DART_EXPORT Dart_Handle Dart_GetScriptURLs(Dart_Handle library_url_in) { | 810 DART_EXPORT Dart_Handle Dart_GetScriptURLs(Dart_Handle library_url_in) { |
810 DARTSCOPE(Thread::Current()); | 811 DARTSCOPE(Thread::Current()); |
811 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); | 812 UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in); |
812 | 813 |
813 const Library& library = Library::Handle(Library::LookupLibrary(library_url)); | 814 const Library& library = Library::Handle(Z, |
| 815 Library::LookupLibrary(T, library_url)); |
814 if (library.IsNull()) { | 816 if (library.IsNull()) { |
815 return Api::NewError("%s: library '%s' not found", | 817 return Api::NewError("%s: library '%s' not found", |
816 CURRENT_FUNC, library_url.ToCString()); | 818 CURRENT_FUNC, library_url.ToCString()); |
817 } | 819 } |
818 const Array& loaded_scripts = Array::Handle(library.LoadedScripts()); | 820 const Array& loaded_scripts = Array::Handle(Z, library.LoadedScripts()); |
819 ASSERT(!loaded_scripts.IsNull()); | 821 ASSERT(!loaded_scripts.IsNull()); |
820 intptr_t num_scripts = loaded_scripts.Length(); | 822 intptr_t num_scripts = loaded_scripts.Length(); |
821 const Array& script_list = Array::Handle(Array::New(num_scripts)); | 823 const Array& script_list = Array::Handle(Z, Array::New(num_scripts)); |
822 Script& script = Script::Handle(); | 824 Script& script = Script::Handle(Z); |
823 String& url = String::Handle(); | 825 String& url = String::Handle(Z); |
824 for (int i = 0; i < num_scripts; i++) { | 826 for (int i = 0; i < num_scripts; i++) { |
825 script ^= loaded_scripts.At(i); | 827 script ^= loaded_scripts.At(i); |
826 url = script.url(); | 828 url = script.url(); |
827 script_list.SetAt(i, url); | 829 script_list.SetAt(i, url); |
828 } | 830 } |
829 return Api::NewHandle(T, script_list.raw()); | 831 return Api::NewHandle(T, script_list.raw()); |
830 } | 832 } |
831 | 833 |
832 | 834 |
833 DART_EXPORT Dart_Handle Dart_GetLibraryIds() { | 835 DART_EXPORT Dart_Handle Dart_GetLibraryIds() { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 | 967 |
966 #else | 968 #else |
967 | 969 |
968 DART_EXPORT void Dart_SetPausedEventHandler(Dart_PausedEventHandler handler) { | 970 DART_EXPORT void Dart_SetPausedEventHandler(Dart_PausedEventHandler handler) { |
969 // NOOP. | 971 // NOOP. |
970 } | 972 } |
971 | 973 |
972 #endif // !PRODUCT | 974 #endif // !PRODUCT |
973 | 975 |
974 } // namespace dart | 976 } // namespace dart |
OLD | NEW |