| 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 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 kernel_program = Dart_ReadKernelBinary(kernel_file, kernel_length); | 925 kernel_program = Dart_ReadKernelBinary(kernel_file, kernel_length); |
| 926 } | 926 } |
| 927 } | 927 } |
| 928 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 928 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 929 | 929 |
| 930 IsolateData* isolate_data = | 930 IsolateData* isolate_data = |
| 931 new IsolateData(script_uri, package_root, packages_config, app_snapshot); | 931 new IsolateData(script_uri, package_root, packages_config, app_snapshot); |
| 932 if (is_main_isolate && (snapshot_deps_filename != NULL)) { | 932 if (is_main_isolate && (snapshot_deps_filename != NULL)) { |
| 933 isolate_data->set_dependencies(new MallocGrowableArray<char*>()); | 933 isolate_data->set_dependencies(new MallocGrowableArray<char*>()); |
| 934 } | 934 } |
| 935 Dart_Isolate isolate = | 935 Dart_Isolate isolate = NULL; |
| 936 kernel_platform != NULL | 936 if (kernel_platform != NULL) { |
| 937 ? Dart_CreateIsolateFromKernel(script_uri, main, kernel_platform, | 937 isolate = Dart_CreateIsolateFromKernel(script_uri, main, kernel_platform, |
| 938 flags, isolate_data, error) | 938 flags, isolate_data, error); |
| 939 : Dart_CreateIsolate(script_uri, main, isolate_snapshot_data, | 939 } else if (kernel_program != NULL) { |
| 940 isolate_snapshot_instructions, flags, | 940 isolate = Dart_CreateIsolateFromKernel(script_uri, main, kernel_program, |
| 941 isolate_data, error); | 941 flags, isolate_data, error); |
| 942 } else { |
| 943 isolate = Dart_CreateIsolate(script_uri, main, isolate_snapshot_data, |
| 944 isolate_snapshot_instructions, flags, |
| 945 isolate_data, error); |
| 946 } |
| 942 if (isolate == NULL) { | 947 if (isolate == NULL) { |
| 943 delete isolate_data; | 948 delete isolate_data; |
| 944 return NULL; | 949 return NULL; |
| 945 } | 950 } |
| 946 | 951 |
| 947 Dart_EnterScope(); | 952 Dart_EnterScope(); |
| 948 | 953 |
| 949 // Set up the library tag handler for this isolate. | 954 // Set up the library tag handler for this isolate. |
| 950 Dart_Handle result = Dart_SetLibraryTagHandler(Loader::LibraryTagHandler); | 955 Dart_Handle result = Dart_SetLibraryTagHandler(Loader::LibraryTagHandler); |
| 951 CHECK_RESULT(result); | 956 CHECK_RESULT(result); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 CHECK_RESULT(result); | 1022 CHECK_RESULT(result); |
| 1018 ASSERT(app_script_uri == NULL); | 1023 ASSERT(app_script_uri == NULL); |
| 1019 app_script_uri = strdup(resolved_script_uri); | 1024 app_script_uri = strdup(resolved_script_uri); |
| 1020 } | 1025 } |
| 1021 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 1026 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 1022 } else { | 1027 } else { |
| 1023 // Load the specified application script into the newly created isolate. | 1028 // Load the specified application script into the newly created isolate. |
| 1024 Dart_Handle uri = | 1029 Dart_Handle uri = |
| 1025 DartUtils::ResolveScript(Dart_NewStringFromCString(script_uri)); | 1030 DartUtils::ResolveScript(Dart_NewStringFromCString(script_uri)); |
| 1026 CHECK_RESULT(uri); | 1031 CHECK_RESULT(uri); |
| 1027 if (kernel_platform == NULL) { | 1032 if (kernel_program == NULL) { |
| 1028 result = Loader::LibraryTagHandler(Dart_kScriptTag, Dart_Null(), uri); | 1033 result = Loader::LibraryTagHandler(Dart_kScriptTag, Dart_Null(), uri); |
| 1029 CHECK_RESULT(result); | 1034 CHECK_RESULT(result); |
| 1030 } else { | 1035 } else { |
| 1031 // Various core-library parts will send requests to the Loader to resolve | 1036 // Various core-library parts will send requests to the Loader to resolve |
| 1032 // relative URIs and perform other related tasks. We need Loader to be | 1037 // relative URIs and perform other related tasks. We need Loader to be |
| 1033 // initialized for this to work because loading from Kernel binary | 1038 // initialized for this to work because loading from Kernel binary |
| 1034 // bypasses normal source code loading paths that initialize it. | 1039 // bypasses normal source code loading paths that initialize it. |
| 1035 Loader::InitForSnapshot(script_uri); | 1040 Loader::InitForSnapshot(script_uri); |
| 1036 } | 1041 } |
| 1037 | 1042 |
| (...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 Platform::Exit(Process::GlobalExitCode()); | 1761 Platform::Exit(Process::GlobalExitCode()); |
| 1757 } | 1762 } |
| 1758 | 1763 |
| 1759 } // namespace bin | 1764 } // namespace bin |
| 1760 } // namespace dart | 1765 } // namespace dart |
| 1761 | 1766 |
| 1762 int main(int argc, char** argv) { | 1767 int main(int argc, char** argv) { |
| 1763 dart::bin::main(argc, argv); | 1768 dart::bin::main(argc, argv); |
| 1764 UNREACHABLE(); | 1769 UNREACHABLE(); |
| 1765 } | 1770 } |
| OLD | NEW |