| 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 "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "include/dart_tools_api.h" | 8 #include "include/dart_tools_api.h" |
| 9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
| 10 | 10 |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 result = Dart_Invoke(builtin_lib, | 721 result = Dart_Invoke(builtin_lib, |
| 722 NewString("_loadPackagesMap"), | 722 NewString("_loadPackagesMap"), |
| 723 kNumArgs, | 723 kNumArgs, |
| 724 dart_args); | 724 dart_args); |
| 725 RETURN_IF_ERROR(result); | 725 RETURN_IF_ERROR(result); |
| 726 } | 726 } |
| 727 return Dart_True(); | 727 return Dart_True(); |
| 728 } | 728 } |
| 729 | 729 |
| 730 | 730 |
| 731 Dart_Handle DartUtils::PrepareCoreLibrary(Dart_Handle core_lib, | 731 Dart_Handle DartUtils::PrepareUriLibrary(Dart_Handle uri_lib, |
| 732 Dart_Handle builtin_lib, | 732 Dart_Handle builtin_lib, |
| 733 bool is_service_isolate) { | 733 bool is_service_isolate) { |
| 734 if (!is_service_isolate) { | 734 if (!is_service_isolate) { |
| 735 // Setup the 'Uri.base' getter in dart:core. | 735 // Setup the 'Uri.base' getter in dart:uri. |
| 736 Dart_Handle uri_base = Dart_Invoke( | 736 Dart_Handle uri_base = Dart_Invoke( |
| 737 builtin_lib, NewString("_getUriBaseClosure"), 0, NULL); | 737 builtin_lib, NewString("_getUriBaseClosure"), 0, NULL); |
| 738 RETURN_IF_ERROR(uri_base); | 738 RETURN_IF_ERROR(uri_base); |
| 739 Dart_Handle result = Dart_SetField(core_lib, | 739 Dart_Handle result = Dart_SetField(uri_lib, |
| 740 NewString("_uriBaseClosure"), | 740 NewString("_uriBaseClosure"), |
| 741 uri_base); | 741 uri_base); |
| 742 RETURN_IF_ERROR(result); | 742 RETURN_IF_ERROR(result); |
| 743 } | 743 } |
| 744 return Dart_True(); | 744 return Dart_True(); |
| 745 } | 745 } |
| 746 | 746 |
| 747 | 747 |
| 748 Dart_Handle DartUtils::PrepareAsyncLibrary(Dart_Handle async_lib, | 748 Dart_Handle DartUtils::PrepareAsyncLibrary(Dart_Handle async_lib, |
| 749 Dart_Handle isolate_lib) { | 749 Dart_Handle isolate_lib) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 url = NewString(kIsolateLibURL); | 786 url = NewString(kIsolateLibURL); |
| 787 RETURN_IF_ERROR(url); | 787 RETURN_IF_ERROR(url); |
| 788 Dart_Handle isolate_lib = Dart_LookupLibrary(url); | 788 Dart_Handle isolate_lib = Dart_LookupLibrary(url); |
| 789 RETURN_IF_ERROR(isolate_lib); | 789 RETURN_IF_ERROR(isolate_lib); |
| 790 url = NewString(kInternalLibURL); | 790 url = NewString(kInternalLibURL); |
| 791 RETURN_IF_ERROR(url); | 791 RETURN_IF_ERROR(url); |
| 792 Dart_Handle internal_lib = Dart_LookupLibrary(url); | 792 Dart_Handle internal_lib = Dart_LookupLibrary(url); |
| 793 RETURN_IF_ERROR(internal_lib); | 793 RETURN_IF_ERROR(internal_lib); |
| 794 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); | 794 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); |
| 795 RETURN_IF_ERROR(io_lib); | 795 RETURN_IF_ERROR(io_lib); |
| 796 url = NewString(kUriLibURL); |
| 797 RETURN_IF_ERROR(url); |
| 798 Dart_Handle uri_lib = Dart_LookupLibrary(url); |
| 799 RETURN_IF_ERROR(uri_lib); |
| 796 | 800 |
| 797 // We need to ensure that all the scripts loaded so far are finalized | 801 // We need to ensure that all the scripts loaded so far are finalized |
| 798 // as we are about to invoke some Dart code below to setup closures. | 802 // as we are about to invoke some Dart code below to setup closures. |
| 799 Dart_Handle result = Dart_FinalizeLoading(false); | 803 Dart_Handle result = Dart_FinalizeLoading(false); |
| 800 RETURN_IF_ERROR(result); | 804 RETURN_IF_ERROR(result); |
| 801 | 805 |
| 802 result = PrepareBuiltinLibrary(builtin_lib, | 806 result = PrepareBuiltinLibrary(builtin_lib, |
| 803 internal_lib, | 807 internal_lib, |
| 804 is_service_isolate, | 808 is_service_isolate, |
| 805 trace_loading, | 809 trace_loading, |
| 806 package_root, | 810 package_root, |
| 807 package_map, | 811 package_map, |
| 808 packages_file); | 812 packages_file); |
| 809 RETURN_IF_ERROR(result); | 813 RETURN_IF_ERROR(result); |
| 810 | 814 |
| 811 RETURN_IF_ERROR(PrepareAsyncLibrary(async_lib, isolate_lib)); | 815 RETURN_IF_ERROR(PrepareAsyncLibrary(async_lib, isolate_lib)); |
| 812 RETURN_IF_ERROR(PrepareCoreLibrary( | 816 RETURN_IF_ERROR(PrepareUriLibrary( |
| 813 core_lib, builtin_lib, is_service_isolate)); | 817 uri_lib, builtin_lib, is_service_isolate)); |
| 814 RETURN_IF_ERROR(PrepareIsolateLibrary(isolate_lib)); | 818 RETURN_IF_ERROR(PrepareIsolateLibrary(isolate_lib)); |
| 815 RETURN_IF_ERROR(PrepareIOLibrary(io_lib)); | 819 RETURN_IF_ERROR(PrepareIOLibrary(io_lib)); |
| 816 return result; | 820 return result; |
| 817 } | 821 } |
| 818 | 822 |
| 819 | 823 |
| 820 Dart_Handle DartUtils::SetupIOLibrary(const char* script_uri) { | 824 Dart_Handle DartUtils::SetupIOLibrary(const char* script_uri) { |
| 821 Dart_Handle io_lib_url = NewString(kIOLibURL); | 825 Dart_Handle io_lib_url = NewString(kIOLibURL); |
| 822 RETURN_IF_ERROR(io_lib_url); | 826 RETURN_IF_ERROR(io_lib_url); |
| 823 Dart_Handle io_lib = Dart_LookupLibrary(io_lib_url); | 827 Dart_Handle io_lib = Dart_LookupLibrary(io_lib_url); |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 new CObjectString(CObject::NewString(os_error->message())); | 1277 new CObjectString(CObject::NewString(os_error->message())); |
| 1274 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 1278 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
| 1275 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 1279 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
| 1276 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 1280 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
| 1277 result->SetAt(2, error_message); | 1281 result->SetAt(2, error_message); |
| 1278 return result; | 1282 return result; |
| 1279 } | 1283 } |
| 1280 | 1284 |
| 1281 } // namespace bin | 1285 } // namespace bin |
| 1282 } // namespace dart | 1286 } // namespace dart |
| OLD | NEW |