| 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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 result = DartUtils::PrepareForScriptLoading(package_root, | 707 result = DartUtils::PrepareForScriptLoading(package_root, |
| 708 packages_file, | 708 packages_file, |
| 709 false, | 709 false, |
| 710 has_trace_loading, | 710 has_trace_loading, |
| 711 builtin_lib); | 711 builtin_lib); |
| 712 CHECK_RESULT(result); | 712 CHECK_RESULT(result); |
| 713 | 713 |
| 714 result = Dart_SetEnvironmentCallback(EnvironmentCallback); | 714 result = Dart_SetEnvironmentCallback(EnvironmentCallback); |
| 715 CHECK_RESULT(result); | 715 CHECK_RESULT(result); |
| 716 | 716 |
| 717 // Load the script. | 717 if (!has_run_precompiled_snapshot) { |
| 718 result = DartUtils::LoadScript(script_uri, builtin_lib); | 718 // Load the script. |
| 719 CHECK_RESULT(result); | 719 result = DartUtils::LoadScript(script_uri, builtin_lib); |
| 720 CHECK_RESULT(result); |
| 720 | 721 |
| 721 // Run event-loop and wait for script loading to complete. | 722 // Run event-loop and wait for script loading to complete. |
| 722 result = Dart_RunLoop(); | 723 result = Dart_RunLoop(); |
| 723 CHECK_RESULT(result); | 724 CHECK_RESULT(result); |
| 724 | 725 |
| 725 if (isolate_data->load_async_id >= 0) { | 726 if (isolate_data->load_async_id >= 0) { |
| 726 Dart_TimelineAsyncEnd("LoadScript", isolate_data->load_async_id); | 727 Dart_TimelineAsyncEnd("LoadScript", isolate_data->load_async_id); |
| 728 } |
| 729 |
| 730 Platform::SetPackageRoot(package_root); |
| 731 |
| 732 DartUtils::SetupIOLibrary(script_uri); |
| 727 } | 733 } |
| 728 | 734 |
| 729 Platform::SetPackageRoot(package_root); | |
| 730 | |
| 731 DartUtils::SetupIOLibrary(script_uri); | |
| 732 | |
| 733 // Make the isolate runnable so that it is ready to handle messages. | 735 // Make the isolate runnable so that it is ready to handle messages. |
| 734 Dart_ExitScope(); | 736 Dart_ExitScope(); |
| 735 Dart_ExitIsolate(); | 737 Dart_ExitIsolate(); |
| 736 bool retval = Dart_IsolateMakeRunnable(isolate); | 738 bool retval = Dart_IsolateMakeRunnable(isolate); |
| 737 if (!retval) { | 739 if (!retval) { |
| 738 *error = strdup("Invalid isolate state - Unable to make it runnable"); | 740 *error = strdup("Invalid isolate state - Unable to make it runnable"); |
| 739 Dart_EnterIsolate(isolate); | 741 Dart_EnterIsolate(isolate); |
| 740 Dart_ShutdownIsolate(); | 742 Dart_ShutdownIsolate(); |
| 741 return NULL; | 743 return NULL; |
| 742 } | 744 } |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 exit(Process::GlobalExitCode()); | 1313 exit(Process::GlobalExitCode()); |
| 1312 } | 1314 } |
| 1313 | 1315 |
| 1314 } // namespace bin | 1316 } // namespace bin |
| 1315 } // namespace dart | 1317 } // namespace dart |
| 1316 | 1318 |
| 1317 int main(int argc, char** argv) { | 1319 int main(int argc, char** argv) { |
| 1318 dart::bin::main(argc, argv); | 1320 dart::bin::main(argc, argv); |
| 1319 UNREACHABLE(); | 1321 UNREACHABLE(); |
| 1320 } | 1322 } |
| OLD | NEW |