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 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 } | 1589 } |
1590 | 1590 |
1591 | 1591 |
1592 DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) { | 1592 DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) { |
1593 TRACE_API_CALL(CURRENT_FUNC); | 1593 TRACE_API_CALL(CURRENT_FUNC); |
1594 if (isolate == NULL) { | 1594 if (isolate == NULL) { |
1595 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); | 1595 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); |
1596 } | 1596 } |
1597 // TODO(16615): Validate isolate parameter. | 1597 // TODO(16615): Validate isolate parameter. |
1598 Isolate* iso = reinterpret_cast<Isolate*>(isolate); | 1598 Isolate* iso = reinterpret_cast<Isolate*>(isolate); |
1599 // Schedule the interrupt. The isolate will notice this bit being set if it | 1599 iso->SendInternalLibMessage(Isolate::kInterruptMsg, iso->pause_capability()); |
1600 // is currently executing in Dart code. | |
1601 iso->ScheduleInterrupts(Isolate::kApiInterrupt); | |
1602 // If the isolate is blocked on the message queue, we post a dummy message | |
1603 // to the isolate's main port. The message will be ultimately ignored, but as | |
1604 // part of handling the message the interrupt bit which was set above will be | |
1605 // honored. | |
1606 // Can't use Dart_Post() since there isn't a current isolate. | |
1607 Dart_CObject api_null = { Dart_CObject_kNull , { 0 } }; | |
1608 Dart_PostCObject(iso->main_port(), &api_null); | |
1609 } | 1600 } |
1610 | 1601 |
1611 | 1602 |
1612 DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate) { | 1603 DART_EXPORT bool Dart_IsolateMakeRunnable(Dart_Isolate isolate) { |
1613 CHECK_NO_ISOLATE(Isolate::Current()); | 1604 CHECK_NO_ISOLATE(Isolate::Current()); |
1614 if (isolate == NULL) { | 1605 if (isolate == NULL) { |
1615 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); | 1606 FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC); |
1616 } | 1607 } |
1617 // TODO(16615): Validate isolate parameter. | 1608 // TODO(16615): Validate isolate parameter. |
1618 Isolate* iso = reinterpret_cast<Isolate*>(isolate); | 1609 Isolate* iso = reinterpret_cast<Isolate*>(isolate); |
(...skipping 4316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5935 ApiReallocate); | 5926 ApiReallocate); |
5936 writer.WriteFullSnapshot(); | 5927 writer.WriteFullSnapshot(); |
5937 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 5928 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
5938 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 5929 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
5939 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); | 5930 *instructions_snapshot_size = writer.InstructionsSnapshotSize(); |
5940 | 5931 |
5941 return Api::Success(); | 5932 return Api::Success(); |
5942 } | 5933 } |
5943 | 5934 |
5944 } // namespace dart | 5935 } // namespace dart |
OLD | NEW |