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 "lib/stacktrace.h" | 10 #include "lib/stacktrace.h" |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1358 | 1358 |
1359 DART_EXPORT void Dart_ThreadEnableProfiling() { | 1359 DART_EXPORT void Dart_ThreadEnableProfiling() { |
1360 OSThread* os_thread = OSThread::Current(); | 1360 OSThread* os_thread = OSThread::Current(); |
1361 if (os_thread == NULL) { | 1361 if (os_thread == NULL) { |
1362 return; | 1362 return; |
1363 } | 1363 } |
1364 os_thread->EnableThreadInterrupts(); | 1364 os_thread->EnableThreadInterrupts(); |
1365 } | 1365 } |
1366 | 1366 |
1367 | 1367 |
1368 DART_EXPORT bool Dart_ShouldPauseOnStart() { | |
1369 Isolate* isolate = Isolate::Current(); | |
1370 CHECK_ISOLATE(isolate); | |
1371 return isolate->message_handler()->pause_on_start(); | |
1372 } | |
1373 | |
1374 | |
1375 DART_EXPORT void Dart_SetShouldPauseOnStart(bool v) { | |
turnidge
2016/02/03 21:33:36
v -> value or perhaps should_pause.
Cutch
2016/02/03 23:04:04
Done.
| |
1376 Isolate* isolate = Isolate::Current(); | |
1377 CHECK_ISOLATE(isolate); | |
1378 isolate->set_pause_isolates_flags_overridden(true); | |
1379 return isolate->message_handler()->set_pause_on_start(v); | |
1380 } | |
1381 | |
1382 | |
1383 DART_EXPORT bool Dart_IsPausedOnStart() { | |
1384 Isolate* isolate = Isolate::Current(); | |
1385 CHECK_ISOLATE(isolate); | |
1386 return isolate->message_handler()->paused_on_start(); | |
1387 } | |
1388 | |
1389 | |
1390 DART_EXPORT void Dart_SetPausedOnStart(bool v) { | |
turnidge
2016/02/03 21:33:36
v -> value or paused, here and below.
Cutch
2016/02/03 23:04:04
Done.
| |
1391 Isolate* isolate = Isolate::Current(); | |
1392 CHECK_ISOLATE(isolate); | |
1393 if (isolate->message_handler()->paused_on_start() != v) { | |
1394 isolate->message_handler()->PausedOnStart(v); | |
1395 if (v) { | |
1396 isolate->message_handler()->NotifyPauseOnStart(); | |
1397 } | |
1398 } | |
turnidge
2016/02/03 21:33:36
As discussed offline, consider making a single api
Cutch
2016/02/03 23:04:04
Done.
| |
1399 } | |
1400 | |
1401 | |
1402 DART_EXPORT bool Dart_ShouldPauseOnExit() { | |
1403 Isolate* isolate = Isolate::Current(); | |
1404 CHECK_ISOLATE(isolate); | |
1405 return isolate->message_handler()->pause_on_exit(); | |
1406 } | |
1407 | |
1408 | |
1409 DART_EXPORT void Dart_SetShouldPauseOnExit(bool v) { | |
1410 Isolate* isolate = Isolate::Current(); | |
1411 CHECK_ISOLATE(isolate); | |
1412 isolate->set_pause_isolates_flags_overridden(true); | |
1413 return isolate->message_handler()->set_pause_on_exit(v); | |
1414 } | |
1415 | |
1416 | |
1417 DART_EXPORT bool Dart_IsPausedOnExit() { | |
1418 Isolate* isolate = Isolate::Current(); | |
1419 CHECK_ISOLATE(isolate); | |
1420 return isolate->message_handler()->paused_on_exit(); | |
1421 } | |
1422 | |
1423 | |
1424 DART_EXPORT void Dart_SetPausedOnExit(bool v) { | |
1425 Isolate* isolate = Isolate::Current(); | |
1426 CHECK_ISOLATE(isolate); | |
1427 if (isolate->message_handler()->paused_on_exit() != v) { | |
1428 isolate->message_handler()->PausedOnExit(v); | |
1429 if (v) { | |
1430 isolate->message_handler()->NotifyPauseOnExit(); | |
1431 } | |
1432 } | |
1433 } | |
1434 | |
1435 | |
1368 DART_EXPORT void Dart_ExitIsolate() { | 1436 DART_EXPORT void Dart_ExitIsolate() { |
1369 Thread* T = Thread::Current(); | 1437 Thread* T = Thread::Current(); |
1370 CHECK_ISOLATE(T->isolate()); | 1438 CHECK_ISOLATE(T->isolate()); |
1371 // The Thread structure is disassociated from the isolate, we do the | 1439 // The Thread structure is disassociated from the isolate, we do the |
1372 // safepoint transition explicity here instead of using the TransitionXXX | 1440 // safepoint transition explicity here instead of using the TransitionXXX |
1373 // scope objects as the original transition happened outside this scope in | 1441 // scope objects as the original transition happened outside this scope in |
1374 // Dart_EnterIsolate/Dart_CreateIsolate. | 1442 // Dart_EnterIsolate/Dart_CreateIsolate. |
1375 ASSERT(T->execution_state() == Thread::kThreadInNative); | 1443 ASSERT(T->execution_state() == Thread::kThreadInNative); |
1376 T->ExitSafepoint(); | 1444 T->ExitSafepoint(); |
1377 T->set_execution_state(Thread::kThreadInVM); | 1445 T->set_execution_state(Thread::kThreadInVM); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1572 TransitionNativeToVM transition(T); | 1640 TransitionNativeToVM transition(T); |
1573 if (I->message_handler()->HandleNextMessage() != MessageHandler::kOK) { | 1641 if (I->message_handler()->HandleNextMessage() != MessageHandler::kOK) { |
1574 Dart_Handle error = Api::NewHandle(T, I->object_store()->sticky_error()); | 1642 Dart_Handle error = Api::NewHandle(T, I->object_store()->sticky_error()); |
1575 I->object_store()->clear_sticky_error(); | 1643 I->object_store()->clear_sticky_error(); |
1576 return error; | 1644 return error; |
1577 } | 1645 } |
1578 return Api::Success(); | 1646 return Api::Success(); |
1579 } | 1647 } |
1580 | 1648 |
1581 | 1649 |
1650 DART_EXPORT Dart_Handle Dart_HandleMessages() { | |
1651 Thread* T = Thread::Current(); | |
1652 Isolate* I = T->isolate(); | |
1653 CHECK_API_SCOPE(T); | |
1654 CHECK_CALLBACK_STATE(T); | |
1655 API_TIMELINE_BEGIN_END; | |
1656 TransitionNativeToVM transition(T); | |
1657 if (I->message_handler()->HandleNormalMessages() != MessageHandler::kOK) { | |
1658 Dart_Handle error = Api::NewHandle(T, I->object_store()->sticky_error()); | |
1659 I->object_store()->clear_sticky_error(); | |
1660 return error; | |
1661 } | |
1662 return Api::Success(); | |
1663 } | |
1664 | |
1665 | |
1582 DART_EXPORT bool Dart_HandleServiceMessages() { | 1666 DART_EXPORT bool Dart_HandleServiceMessages() { |
1583 Thread* T = Thread::Current(); | 1667 Thread* T = Thread::Current(); |
1584 Isolate* I = T->isolate(); | 1668 Isolate* I = T->isolate(); |
1585 CHECK_API_SCOPE(T); | 1669 CHECK_API_SCOPE(T); |
1586 CHECK_CALLBACK_STATE(T); | 1670 CHECK_CALLBACK_STATE(T); |
1587 API_TIMELINE_DURATION; | 1671 API_TIMELINE_DURATION; |
1588 TransitionNativeToVM transition(T); | 1672 TransitionNativeToVM transition(T); |
1589 ASSERT(I->GetAndClearResumeRequest() == false); | 1673 ASSERT(I->GetAndClearResumeRequest() == false); |
1590 MessageHandler::MessageStatus status = | 1674 MessageHandler::MessageStatus status = |
1591 I->message_handler()->HandleOOBMessages(); | 1675 I->message_handler()->HandleOOBMessages(); |
(...skipping 4423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6015 return Api::Success(); | 6099 return Api::Success(); |
6016 } | 6100 } |
6017 #endif // DART_PRECOMPILER | 6101 #endif // DART_PRECOMPILER |
6018 | 6102 |
6019 | 6103 |
6020 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { | 6104 DART_EXPORT bool Dart_IsRunningPrecompiledCode() { |
6021 return Dart::IsRunningPrecompiledCode(); | 6105 return Dart::IsRunningPrecompiledCode(); |
6022 } | 6106 } |
6023 | 6107 |
6024 } // namespace dart | 6108 } // namespace dart |
OLD | NEW |