Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 1439483003: - Add an OSThread structure which is the generic TLS structure for all C++ (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/dart_api_impl.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 1358
1359 1359
1360 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri, 1360 DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri,
1361 const char* main, 1361 const char* main,
1362 const uint8_t* snapshot, 1362 const uint8_t* snapshot,
1363 Dart_IsolateFlags* flags, 1363 Dart_IsolateFlags* flags,
1364 void* callback_data, 1364 void* callback_data,
1365 char** error) { 1365 char** error) {
1366 CHECK_NO_ISOLATE(Isolate::Current()); 1366 CHECK_NO_ISOLATE(Isolate::Current());
1367 char* isolate_name = BuildIsolateName(script_uri, main); 1367 char* isolate_name = BuildIsolateName(script_uri, main);
1368 Thread::EnsureInit();
1369 1368
1370 // Setup default flags in case none were passed. 1369 // Setup default flags in case none were passed.
1371 Dart_IsolateFlags api_flags; 1370 Dart_IsolateFlags api_flags;
1372 if (flags == NULL) { 1371 if (flags == NULL) {
1373 Isolate::Flags vm_flags; 1372 Isolate::Flags vm_flags;
1374 vm_flags.CopyTo(&api_flags); 1373 vm_flags.CopyTo(&api_flags);
1375 flags = &api_flags; 1374 flags = &api_flags;
1376 } 1375 }
1377 Isolate* I = Dart::CreateIsolate(isolate_name, *flags); 1376 Isolate* I = Dart::CreateIsolate(isolate_name, *flags);
1378 free(isolate_name); 1377 free(isolate_name);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 1451
1453 1452
1454 1453
1455 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) { 1454 DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate) {
1456 CHECK_NO_ISOLATE(Isolate::Current()); 1455 CHECK_NO_ISOLATE(Isolate::Current());
1457 // TODO(16615): Validate isolate parameter. 1456 // TODO(16615): Validate isolate parameter.
1458 Isolate* iso = reinterpret_cast<Isolate*>(isolate); 1457 Isolate* iso = reinterpret_cast<Isolate*>(isolate);
1459 if (iso->HasMutatorThread()) { 1458 if (iso->HasMutatorThread()) {
1460 FATAL("Multiple mutators within one isolate is not supported."); 1459 FATAL("Multiple mutators within one isolate is not supported.");
1461 } 1460 }
1462 Thread::EnsureInit();
1463 Thread::EnterIsolate(iso); 1461 Thread::EnterIsolate(iso);
1464 } 1462 }
1465 1463
1466 1464
1467 DART_EXPORT void Dart_ThreadDisableProfiling() { 1465 DART_EXPORT void Dart_ThreadDisableProfiling() {
1468 Thread* T = Thread::Current(); 1466 OSThread* os_thread = OSThread::Current();
1469 if (T == NULL) { 1467 if (os_thread == NULL) {
1470 return; 1468 return;
1471 } 1469 }
1472 T->DisableThreadInterrupts(); 1470 os_thread->DisableThreadInterrupts();
1473 } 1471 }
1474 1472
1475 1473
1476 DART_EXPORT void Dart_ThreadEnableProfiling() { 1474 DART_EXPORT void Dart_ThreadEnableProfiling() {
1477 Thread* T = Thread::Current(); 1475 OSThread* os_thread = OSThread::Current();
1478 if (T == NULL) { 1476 if (os_thread == NULL) {
1479 return; 1477 return;
1480 } 1478 }
1481 T->EnableThreadInterrupts(); 1479 os_thread->EnableThreadInterrupts();
1482 } 1480 }
1483 1481
1484 1482
1485 DART_EXPORT void Dart_ExitIsolate() { 1483 DART_EXPORT void Dart_ExitIsolate() {
1486 CHECK_ISOLATE(Isolate::Current()); 1484 CHECK_ISOLATE(Isolate::Current());
1487 Thread::ExitIsolate(); 1485 Thread::ExitIsolate();
1488 } 1486 }
1489 1487
1490 1488
1491 // TODO(iposva): Remove this API and instead expose the underlying flags. 1489 // TODO(iposva): Remove this API and instead expose the underlying flags.
(...skipping 4596 matching lines...) Expand 10 before | Expand all | Expand 10 after
6088 ApiReallocate); 6086 ApiReallocate);
6089 writer.WriteFullSnapshot(); 6087 writer.WriteFullSnapshot();
6090 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); 6088 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize();
6091 *isolate_snapshot_size = writer.IsolateSnapshotSize(); 6089 *isolate_snapshot_size = writer.IsolateSnapshotSize();
6092 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); 6090 *instructions_snapshot_size = writer.InstructionsSnapshotSize();
6093 6091
6094 return Api::Success(); 6092 return Api::Success();
6095 } 6093 }
6096 6094
6097 } // namespace dart 6095 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698