| 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_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 | 9 |
| 10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 ASSERT(tag == Dart_kSourceTag); | 735 ASSERT(tag == Dart_kSourceTag); |
| 736 Dart_Handle library = Dart_LookupLibrary(library_uri); | 736 Dart_Handle library = Dart_LookupLibrary(library_uri); |
| 737 DART_CHECK_VALID(library); | 737 DART_CHECK_VALID(library); |
| 738 result = Dart_LoadSource(library, resolved_script_uri, sourceText); | 738 result = Dart_LoadSource(library, resolved_script_uri, sourceText); |
| 739 } | 739 } |
| 740 if (Dart_IsError(result)) Dart_PropagateError(result); | 740 if (Dart_IsError(result)) Dart_PropagateError(result); |
| 741 } | 741 } |
| 742 | 742 |
| 743 | 743 |
| 744 // Callback function that gets called from dartutils when there are | 744 // Callback function that gets called from dartutils when there are |
| 745 // no more outstanding load requests. Invoke Dart core library function | 745 // no more outstanding load requests. |
| 746 // that completes futures of loadLibrary calls (deferred library loading). | |
| 747 // Invoking this function finalizes newly loaded classes as a side | |
| 748 // effect. | |
| 749 void FUNCTION_NAME(Builtin_DoneLoading)(Dart_NativeArguments args) { | 746 void FUNCTION_NAME(Builtin_DoneLoading)(Dart_NativeArguments args) { |
| 750 Dart_Handle corelib_url = DartUtils::NewString(DartUtils::kCoreLibURL); | 747 Dart_Handle res = Dart_FinalizeLoading(); |
| 751 DART_CHECK_VALID(corelib_url); | |
| 752 Dart_Handle corelib = Dart_LookupLibrary(corelib_url); | |
| 753 DART_CHECK_VALID(corelib); | |
| 754 Dart_Handle res = | |
| 755 Dart_Invoke(corelib, | |
| 756 DartUtils::NewString("_completeDeferredLoads"), | |
| 757 0, | |
| 758 NULL); | |
| 759 if (Dart_IsError(res)) { | 748 if (Dart_IsError(res)) { |
| 760 Dart_PropagateError(res); | 749 Dart_PropagateError(res); |
| 761 } | 750 } |
| 762 } | 751 } |
| 763 | 752 |
| 764 | 753 |
| 765 Dart_Handle DartUtils::LoadSource(Dart_Handle library, | 754 Dart_Handle DartUtils::LoadSource(Dart_Handle library, |
| 766 Dart_Handle url, | 755 Dart_Handle url, |
| 767 Dart_LibraryTag tag, | 756 Dart_LibraryTag tag, |
| 768 const char* url_string) { | 757 const char* url_string) { |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 new CObjectString(CObject::NewString(os_error->message())); | 1153 new CObjectString(CObject::NewString(os_error->message())); |
| 1165 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 1154 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
| 1166 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 1155 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
| 1167 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 1156 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
| 1168 result->SetAt(2, error_message); | 1157 result->SetAt(2, error_message); |
| 1169 return result; | 1158 return result; |
| 1170 } | 1159 } |
| 1171 | 1160 |
| 1172 } // namespace bin | 1161 } // namespace bin |
| 1173 } // namespace dart | 1162 } // namespace dart |
| OLD | NEW |