| 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 <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 #include "include/dart_tools_api.h" | 10 #include "include/dart_tools_api.h" |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 result = DartUtils::PrepareForScriptLoading(package_root, | 744 result = DartUtils::PrepareForScriptLoading(package_root, |
| 745 packages_file, | 745 packages_file, |
| 746 false, | 746 false, |
| 747 has_trace_loading, | 747 has_trace_loading, |
| 748 builtin_lib); | 748 builtin_lib); |
| 749 CHECK_RESULT(result); | 749 CHECK_RESULT(result); |
| 750 | 750 |
| 751 result = Dart_SetEnvironmentCallback(EnvironmentCallback); | 751 result = Dart_SetEnvironmentCallback(EnvironmentCallback); |
| 752 CHECK_RESULT(result); | 752 CHECK_RESULT(result); |
| 753 | 753 |
| 754 // Load the script. | 754 if (!has_run_precompiled_snapshot) { |
| 755 result = DartUtils::LoadScript(script_uri, builtin_lib); | 755 // Load the script. |
| 756 CHECK_RESULT(result); | 756 result = DartUtils::LoadScript(script_uri, builtin_lib); |
| 757 CHECK_RESULT(result); |
| 757 | 758 |
| 758 // Run event-loop and wait for script loading to complete. | 759 // Run event-loop and wait for script loading to complete. |
| 759 result = Dart_RunLoop(); | 760 result = Dart_RunLoop(); |
| 760 CHECK_RESULT(result); | 761 CHECK_RESULT(result); |
| 761 | 762 |
| 762 if (isolate_data->load_async_id >= 0) { | 763 if (isolate_data->load_async_id >= 0) { |
| 763 Dart_TimelineAsyncEnd("LoadScript", isolate_data->load_async_id); | 764 Dart_TimelineAsyncEnd("LoadScript", isolate_data->load_async_id); |
| 765 } |
| 766 |
| 767 Platform::SetPackageRoot(package_root); |
| 768 |
| 769 result = DartUtils::SetupIOLibrary(script_uri); |
| 770 CHECK_RESULT(result); |
| 764 } | 771 } |
| 765 | 772 |
| 766 Platform::SetPackageRoot(package_root); | |
| 767 | |
| 768 result = DartUtils::SetupIOLibrary(script_uri); | |
| 769 CHECK_RESULT(result); | |
| 770 | |
| 771 // Make the isolate runnable so that it is ready to handle messages. | 773 // Make the isolate runnable so that it is ready to handle messages. |
| 772 Dart_ExitScope(); | 774 Dart_ExitScope(); |
| 773 Dart_ExitIsolate(); | 775 Dart_ExitIsolate(); |
| 774 bool retval = Dart_IsolateMakeRunnable(isolate); | 776 bool retval = Dart_IsolateMakeRunnable(isolate); |
| 775 if (!retval) { | 777 if (!retval) { |
| 776 *error = strdup("Invalid isolate state - Unable to make it runnable"); | 778 *error = strdup("Invalid isolate state - Unable to make it runnable"); |
| 777 Dart_EnterIsolate(isolate); | 779 Dart_EnterIsolate(isolate); |
| 778 Dart_ShutdownIsolate(); | 780 Dart_ShutdownIsolate(); |
| 779 return NULL; | 781 return NULL; |
| 780 } | 782 } |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1368 exit(Process::GlobalExitCode()); | 1370 exit(Process::GlobalExitCode()); |
| 1369 } | 1371 } |
| 1370 | 1372 |
| 1371 } // namespace bin | 1373 } // namespace bin |
| 1372 } // namespace dart | 1374 } // namespace dart |
| 1373 | 1375 |
| 1374 int main(int argc, char** argv) { | 1376 int main(int argc, char** argv) { |
| 1375 dart::bin::main(argc, argv); | 1377 dart::bin::main(argc, argv); |
| 1376 UNREACHABLE(); | 1378 UNREACHABLE(); |
| 1377 } | 1379 } |
| OLD | NEW |