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 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 NewString("_printClosure"), | 792 NewString("_printClosure"), |
793 print); | 793 print); |
794 DART_CHECK_VALID(result); | 794 DART_CHECK_VALID(result); |
795 | 795 |
796 // Setup the 'timer' factory. | 796 // Setup the 'timer' factory. |
797 url = NewString(kAsyncLibURL); | 797 url = NewString(kAsyncLibURL); |
798 DART_CHECK_VALID(url); | 798 DART_CHECK_VALID(url); |
799 Dart_Handle async_lib = Dart_LookupLibrary(url); | 799 Dart_Handle async_lib = Dart_LookupLibrary(url); |
800 DART_CHECK_VALID(async_lib); | 800 DART_CHECK_VALID(async_lib); |
801 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); | 801 Dart_Handle io_lib = Builtin::LoadAndCheckLibrary(Builtin::kIOLibrary); |
| 802 |
| 803 // We need to ensure that all the scripts loaded so far are finalized |
| 804 // as we are about to invoke some Dart code below to setup closures. |
| 805 result = Dart_FinalizeLoading(false); |
| 806 DART_CHECK_VALID(result); |
| 807 |
802 Dart_Handle timer_closure = | 808 Dart_Handle timer_closure = |
803 Dart_Invoke(io_lib, NewString("_getTimerFactoryClosure"), 0, NULL); | 809 Dart_Invoke(io_lib, NewString("_getTimerFactoryClosure"), 0, NULL); |
804 Dart_Handle args[1]; | 810 Dart_Handle args[1]; |
805 args[0] = timer_closure; | 811 args[0] = timer_closure; |
806 DART_CHECK_VALID(Dart_Invoke( | 812 DART_CHECK_VALID(Dart_Invoke( |
807 async_lib, NewString("_setTimerFactoryClosure"), 1, args)); | 813 async_lib, NewString("_setTimerFactoryClosure"), 1, args)); |
808 | 814 |
809 // Setup the 'scheduleImmediate' closure. | 815 // Setup the 'scheduleImmediate' closure. |
810 url = NewString(kIsolateLibURL); | 816 url = NewString(kIsolateLibURL); |
811 DART_CHECK_VALID(url); | 817 DART_CHECK_VALID(url); |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 new CObjectString(CObject::NewString(os_error->message())); | 1159 new CObjectString(CObject::NewString(os_error->message())); |
1154 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); | 1160 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); |
1155 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); | 1161 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); |
1156 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); | 1162 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); |
1157 result->SetAt(2, error_message); | 1163 result->SetAt(2, error_message); |
1158 return result; | 1164 return result; |
1159 } | 1165 } |
1160 | 1166 |
1161 } // namespace bin | 1167 } // namespace bin |
1162 } // namespace dart | 1168 } // namespace dart |
OLD | NEW |