| 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 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 // TODO(16615): Validate isolate parameter. | 1457 // TODO(16615): Validate isolate parameter. |
| 1458 Isolate* iso = reinterpret_cast<Isolate*>(isolate); | 1458 Isolate* iso = reinterpret_cast<Isolate*>(isolate); |
| 1459 if (iso->HasMutatorThread()) { | 1459 if (iso->HasMutatorThread()) { |
| 1460 FATAL("Multiple mutators within one isolate is not supported."); | 1460 FATAL("Multiple mutators within one isolate is not supported."); |
| 1461 } | 1461 } |
| 1462 Thread::EnsureInit(); | 1462 Thread::EnsureInit(); |
| 1463 Thread::EnterIsolate(iso); | 1463 Thread::EnterIsolate(iso); |
| 1464 } | 1464 } |
| 1465 | 1465 |
| 1466 | 1466 |
| 1467 DART_EXPORT void Dart_IsolateBlocked() { | 1467 DART_EXPORT void Dart_ThreadDisableProfiling() { |
| 1468 Isolate* isolate = Isolate::Current(); | 1468 Thread* T = Thread::Current(); |
| 1469 CHECK_ISOLATE(isolate); | 1469 if (T == NULL) { |
| 1470 IsolateProfilerData* profiler_data = isolate->profiler_data(); | |
| 1471 if (profiler_data == NULL) { | |
| 1472 return; | 1470 return; |
| 1473 } | 1471 } |
| 1474 profiler_data->Block(); | 1472 T->DisableThreadInterrupts(); |
| 1475 } | 1473 } |
| 1476 | 1474 |
| 1477 | 1475 |
| 1478 DART_EXPORT void Dart_IsolateUnblocked() { | 1476 DART_EXPORT void Dart_ThreadEnableProfiling() { |
| 1479 Isolate* isolate = Isolate::Current(); | 1477 Thread* T = Thread::Current(); |
| 1480 CHECK_ISOLATE(isolate); | 1478 if (T == NULL) { |
| 1481 IsolateProfilerData* profiler_data = isolate->profiler_data(); | |
| 1482 if (profiler_data == NULL) { | |
| 1483 return; | 1479 return; |
| 1484 } | 1480 } |
| 1485 profiler_data->Unblock(); | 1481 T->EnableThreadInterrupts(); |
| 1486 } | 1482 } |
| 1487 | 1483 |
| 1488 | 1484 |
| 1489 DART_EXPORT void Dart_ExitIsolate() { | 1485 DART_EXPORT void Dart_ExitIsolate() { |
| 1490 CHECK_ISOLATE(Isolate::Current()); | 1486 CHECK_ISOLATE(Isolate::Current()); |
| 1491 Thread::ExitIsolate(); | 1487 Thread::ExitIsolate(); |
| 1492 } | 1488 } |
| 1493 | 1489 |
| 1494 | 1490 |
| 1495 // TODO(iposva): Remove this API and instead expose the underlying flags. | 1491 // TODO(iposva): Remove this API and instead expose the underlying flags. |
| (...skipping 4591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6087 ApiReallocate); | 6083 ApiReallocate); |
| 6088 writer.WriteFullSnapshot(); | 6084 writer.WriteFullSnapshot(); |
| 6089 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 6085 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
| 6090 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 6086 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
| 6091 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); | 6087 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); |
| 6092 | 6088 |
| 6093 return Api::Success(); | 6089 return Api::Success(); |
| 6094 } | 6090 } |
| 6095 | 6091 |
| 6096 } // namespace dart | 6092 } // namespace dart |
| OLD | NEW |