| 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 "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri, | 1294 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri, |
| 1295 const char* main, | 1295 const char* main, |
| 1296 const uint8_t* snapshot, | 1296 const uint8_t* snapshot, |
| 1297 void* callback_data, | 1297 void* callback_data, |
| 1298 char** error) { | 1298 char** error) { |
| 1299 CHECK_NO_ISOLATE(Isolate::Current()); | 1299 CHECK_NO_ISOLATE(Isolate::Current()); |
| 1300 char* isolate_name = BuildIsolateName(script_uri, main); | 1300 char* isolate_name = BuildIsolateName(script_uri, main); |
| 1301 Thread::EnsureInit(); | 1301 Thread::EnsureInit(); |
| 1302 Isolate* isolate = Dart::CreateIsolate(isolate_name); | 1302 Isolate* isolate = Dart::CreateIsolate(isolate_name); |
| 1303 free(isolate_name); | 1303 free(isolate_name); |
| 1304 { | 1304 StackZone zone(isolate); |
| 1305 StackZone zone(isolate); | 1305 HANDLESCOPE(isolate); |
| 1306 HANDLESCOPE(isolate); | 1306 // We enter an API scope here as InitializeIsolate could compile some |
| 1307 const Error& error_obj = | 1307 // bootstrap library files which call out to a tag handler that may create |
| 1308 Error::Handle(isolate, | 1308 // Api Handles when an error is encountered. |
| 1309 Dart::InitializeIsolate(snapshot, callback_data)); | 1309 Dart_EnterScope(); |
| 1310 if (error_obj.IsNull()) { | 1310 const Error& error_obj = |
| 1311 Error::Handle(isolate, Dart::InitializeIsolate(snapshot, callback_data)); |
| 1312 if (error_obj.IsNull()) { |
| 1311 #if defined(DART_NO_SNAPSHOT) | 1313 #if defined(DART_NO_SNAPSHOT) |
| 1312 if (FLAG_check_function_fingerprints) { | 1314 if (FLAG_check_function_fingerprints) { |
| 1313 Library::CheckFunctionFingerprints(); | 1315 Library::CheckFunctionFingerprints(); |
| 1314 } | 1316 } |
| 1315 #endif // defined(DART_NO_SNAPSHOT). | 1317 #endif // defined(DART_NO_SNAPSHOT). |
| 1316 START_TIMER(isolate, time_total_runtime); | 1318 // We exit the API scope entered above. |
| 1317 return Api::CastIsolate(isolate); | 1319 Dart_ExitScope(); |
| 1318 } | 1320 START_TIMER(isolate, time_total_runtime); |
| 1319 *error = strdup(error_obj.ToErrorCString()); | 1321 return Api::CastIsolate(isolate); |
| 1320 } | 1322 } |
| 1323 *error = strdup(error_obj.ToErrorCString()); |
| 1324 // We exit the API scope entered above. |
| 1325 Dart_ExitScope(); |
| 1321 Dart::ShutdownIsolate(); | 1326 Dart::ShutdownIsolate(); |
| 1322 return DART_ILLEGAL_ISOLATE; | 1327 return DART_ILLEGAL_ISOLATE; |
| 1323 } | 1328 } |
| 1324 | 1329 |
| 1325 | 1330 |
| 1326 DART_EXPORT void Dart_ShutdownIsolate() { | 1331 DART_EXPORT void Dart_ShutdownIsolate() { |
| 1327 Isolate* isolate = Isolate::Current(); | 1332 Isolate* isolate = Isolate::Current(); |
| 1328 CHECK_ISOLATE(isolate); | 1333 CHECK_ISOLATE(isolate); |
| 1329 { | 1334 { |
| 1330 StackZone zone(isolate); | 1335 StackZone zone(isolate); |
| (...skipping 4251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5582 | 5587 |
| 5583 | 5588 |
| 5584 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5589 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
| 5585 const char* name, | 5590 const char* name, |
| 5586 Dart_ServiceRequestCallback callback, | 5591 Dart_ServiceRequestCallback callback, |
| 5587 void* user_data) { | 5592 void* user_data) { |
| 5588 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5593 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
| 5589 } | 5594 } |
| 5590 | 5595 |
| 5591 } // namespace dart | 5596 } // namespace dart |
| OLD | NEW |