| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "lib/stacktrace.h" | 10 #include "lib/stacktrace.h" |
| (...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1135 return Api::Success(); | 1135 return Api::Success(); |
| 1136 } | 1136 } |
| 1137 | 1137 |
| 1138 | 1138 |
| 1139 // --- Initialization and Globals --- | 1139 // --- Initialization and Globals --- |
| 1140 | 1140 |
| 1141 DART_EXPORT const char* Dart_VersionString() { | 1141 DART_EXPORT const char* Dart_VersionString() { |
| 1142 return Version::String(); | 1142 return Version::String(); |
| 1143 } | 1143 } |
| 1144 | 1144 |
| 1145 DART_EXPORT char* Dart_Initialize( | 1145 DART_EXPORT char* Dart_Initialize(Dart_InitializeParams* params) { |
| 1146 const uint8_t* vm_isolate_snapshot, | 1146 if (params == NULL) { |
| 1147 const uint8_t* instructions_snapshot, | |
| 1148 const uint8_t* data_snapshot, | |
| 1149 Dart_IsolateCreateCallback create, | |
| 1150 Dart_IsolateInterruptCallback interrupt, | |
| 1151 Dart_IsolateUnhandledExceptionCallback unhandled, | |
| 1152 Dart_IsolateShutdownCallback shutdown, | |
| 1153 Dart_ThreadExitCallback thread_exit, | |
| 1154 Dart_FileOpenCallback file_open, | |
| 1155 Dart_FileReadCallback file_read, | |
| 1156 Dart_FileWriteCallback file_write, | |
| 1157 Dart_FileCloseCallback file_close, | |
| 1158 Dart_EntropySource entropy_source, | |
| 1159 Dart_GetVMServiceAssetsArchive get_service_assets) { | |
| 1160 if (interrupt != NULL) { | |
| 1161 return strdup("Dart_Initialize: " | 1147 return strdup("Dart_Initialize: " |
| 1162 "Setting of interrupt callback is not supported."); | 1148 "Dart_InitializeParams is null."); |
| 1163 } | 1149 } |
| 1164 if (unhandled != NULL) { | 1150 |
| 1151 if (params->version != DART_INITIALIZE_PARAMS_CURRENT_VERSION) { |
| 1165 return strdup("Dart_Initialize: " | 1152 return strdup("Dart_Initialize: " |
| 1166 "Setting of unhandled exception callback is not supported."); | 1153 "Invalid Dart_InitializeParams version."); |
| 1167 } | 1154 } |
| 1168 return Dart::InitOnce(vm_isolate_snapshot, | 1155 |
| 1169 instructions_snapshot, | 1156 return Dart::InitOnce(params->vm_isolate_snapshot, |
| 1170 data_snapshot, | 1157 params->instructions_snapshot, |
| 1171 create, shutdown, | 1158 params->data_snapshot, |
| 1172 thread_exit, | 1159 params->create, |
| 1173 file_open, file_read, file_write, file_close, | 1160 params->shutdown, |
| 1174 entropy_source, | 1161 params->thread_exit, |
| 1175 get_service_assets); | 1162 params->file_open, |
| 1163 params->file_read, |
| 1164 params->file_write, |
| 1165 params->file_close, |
| 1166 params->entropy_source, |
| 1167 params->get_service_assets); |
| 1176 } | 1168 } |
| 1177 | 1169 |
| 1178 | 1170 |
| 1179 DART_EXPORT char* Dart_Cleanup() { | 1171 DART_EXPORT char* Dart_Cleanup() { |
| 1180 CHECK_NO_ISOLATE(Isolate::Current()); | 1172 CHECK_NO_ISOLATE(Isolate::Current()); |
| 1181 const char* err_msg = Dart::Cleanup(); | 1173 const char* err_msg = Dart::Cleanup(); |
| 1182 if (err_msg != NULL) { | 1174 if (err_msg != NULL) { |
| 1183 return strdup(err_msg); | 1175 return strdup(err_msg); |
| 1184 } | 1176 } |
| 1185 return NULL; | 1177 return NULL; |
| (...skipping 5376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6562 | 6554 |
| 6563 DART_EXPORT bool Dart_IsPrecompiledRuntime() { | 6555 DART_EXPORT bool Dart_IsPrecompiledRuntime() { |
| 6564 #if defined(DART_PRECOMPILED_RUNTIME) | 6556 #if defined(DART_PRECOMPILED_RUNTIME) |
| 6565 return true; | 6557 return true; |
| 6566 #else | 6558 #else |
| 6567 return false; | 6559 return false; |
| 6568 #endif | 6560 #endif |
| 6569 } | 6561 } |
| 6570 | 6562 |
| 6571 } // namespace dart | 6563 } // namespace dart |
| OLD | NEW |