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