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 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 } | 1283 } |
1284 | 1284 |
1285 | 1285 |
1286 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri, | 1286 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri, |
1287 const char* main, | 1287 const char* main, |
1288 const uint8_t* snapshot, | 1288 const uint8_t* snapshot, |
1289 void* callback_data, | 1289 void* callback_data, |
1290 char** error) { | 1290 char** error) { |
1291 CHECK_NO_ISOLATE(Isolate::Current()); | 1291 CHECK_NO_ISOLATE(Isolate::Current()); |
1292 char* isolate_name = BuildIsolateName(script_uri, main); | 1292 char* isolate_name = BuildIsolateName(script_uri, main); |
| 1293 Thread::EnsureInit(); |
1293 Isolate* isolate = Dart::CreateIsolate(isolate_name); | 1294 Isolate* isolate = Dart::CreateIsolate(isolate_name); |
1294 free(isolate_name); | 1295 free(isolate_name); |
1295 { | 1296 { |
1296 StackZone zone(isolate); | 1297 StackZone zone(isolate); |
1297 HANDLESCOPE(isolate); | 1298 HANDLESCOPE(isolate); |
1298 const Error& error_obj = | 1299 const Error& error_obj = |
1299 Error::Handle(isolate, | 1300 Error::Handle(isolate, |
1300 Dart::InitializeIsolate(snapshot, callback_data)); | 1301 Dart::InitializeIsolate(snapshot, callback_data)); |
1301 if (error_obj.IsNull()) { | 1302 if (error_obj.IsNull()) { |
1302 #if defined(DART_NO_SNAPSHOT) | 1303 #if defined(DART_NO_SNAPSHOT) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 | 1359 |
1359 | 1360 |
1360 | 1361 |
1361 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) { | 1362 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) { |
1362 CHECK_NO_ISOLATE(Isolate::Current()); | 1363 CHECK_NO_ISOLATE(Isolate::Current()); |
1363 // TODO(16615): Validate isolate parameter. | 1364 // TODO(16615): Validate isolate parameter. |
1364 Isolate* iso = reinterpret_cast<Isolate*>(isolate); | 1365 Isolate* iso = reinterpret_cast<Isolate*>(isolate); |
1365 if (iso->mutator_thread() != NULL) { | 1366 if (iso->mutator_thread() != NULL) { |
1366 FATAL("Multiple mutators within one isolate is not supported."); | 1367 FATAL("Multiple mutators within one isolate is not supported."); |
1367 } | 1368 } |
| 1369 Thread::EnsureInit(); |
1368 Thread::EnterIsolate(iso); | 1370 Thread::EnterIsolate(iso); |
1369 } | 1371 } |
1370 | 1372 |
1371 | 1373 |
1372 DART_EXPORT void Dart_IsolateBlocked() { | 1374 DART_EXPORT void Dart_IsolateBlocked() { |
1373 Isolate* isolate = Isolate::Current(); | 1375 Isolate* isolate = Isolate::Current(); |
1374 CHECK_ISOLATE(isolate); | 1376 CHECK_ISOLATE(isolate); |
1375 IsolateProfilerData* profiler_data = isolate->profiler_data(); | 1377 IsolateProfilerData* profiler_data = isolate->profiler_data(); |
1376 if (profiler_data == NULL) { | 1378 if (profiler_data == NULL) { |
1377 return; | 1379 return; |
(...skipping 4190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5568 | 5570 |
5569 | 5571 |
5570 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5572 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
5571 const char* name, | 5573 const char* name, |
5572 Dart_ServiceRequestCallback callback, | 5574 Dart_ServiceRequestCallback callback, |
5573 void* user_data) { | 5575 void* user_data) { |
5574 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5576 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
5575 } | 5577 } |
5576 | 5578 |
5577 } // namespace dart | 5579 } // namespace dart |
OLD | NEW |