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

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

Issue 2979243002: Remove some pause-related fields in a PRODUCT build (Closed)
Patch Set: . Created 3 years, 5 months 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.cc ('k') | runtime/vm/isolate.h » ('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 "lib/stacktrace.h" 9 #include "lib/stacktrace.h"
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 1304
1305 DART_EXPORT void Dart_ThreadEnableProfiling() { 1305 DART_EXPORT void Dart_ThreadEnableProfiling() {
1306 OSThread* os_thread = OSThread::Current(); 1306 OSThread* os_thread = OSThread::Current();
1307 if (os_thread == NULL) { 1307 if (os_thread == NULL) {
1308 return; 1308 return;
1309 } 1309 }
1310 os_thread->EnableThreadInterrupts(); 1310 os_thread->EnableThreadInterrupts();
1311 } 1311 }
1312 1312
1313 DART_EXPORT bool Dart_ShouldPauseOnStart() { 1313 DART_EXPORT bool Dart_ShouldPauseOnStart() {
1314 #if defined(PRODUCT)
1315 return false;
1316 #else
1314 Isolate* isolate = Isolate::Current(); 1317 Isolate* isolate = Isolate::Current();
1315 CHECK_ISOLATE(isolate); 1318 CHECK_ISOLATE(isolate);
1316 NoSafepointScope no_safepoint_scope; 1319 NoSafepointScope no_safepoint_scope;
1317 return isolate->message_handler()->should_pause_on_start(); 1320 return isolate->message_handler()->should_pause_on_start();
1321 #endif
1318 } 1322 }
1319 1323
1320 DART_EXPORT void Dart_SetShouldPauseOnStart(bool should_pause) { 1324 DART_EXPORT void Dart_SetShouldPauseOnStart(bool should_pause) {
1325 #if defined(PRODUCT)
1326 if (should_pause) {
1327 FATAL1("%s(true) is not supported in a PRODUCT build", CURRENT_FUNC);
1328 }
1329 #else
1321 Isolate* isolate = Isolate::Current(); 1330 Isolate* isolate = Isolate::Current();
1322 CHECK_ISOLATE(isolate); 1331 CHECK_ISOLATE(isolate);
1323 NoSafepointScope no_safepoint_scope; 1332 NoSafepointScope no_safepoint_scope;
1324 if (isolate->is_runnable()) { 1333 if (isolate->is_runnable()) {
1325 FATAL1("%s expects the current isolate to not be runnable yet.", 1334 FATAL1("%s expects the current isolate to not be runnable yet.",
1326 CURRENT_FUNC); 1335 CURRENT_FUNC);
1327 } 1336 }
1328 return isolate->message_handler()->set_should_pause_on_start(should_pause); 1337 isolate->message_handler()->set_should_pause_on_start(should_pause);
1338 #endif
1329 } 1339 }
1330 1340
1331 DART_EXPORT bool Dart_IsPausedOnStart() { 1341 DART_EXPORT bool Dart_IsPausedOnStart() {
1342 #if defined(PRODUCT)
1343 return false;
1344 #else
1332 Isolate* isolate = Isolate::Current(); 1345 Isolate* isolate = Isolate::Current();
1333 CHECK_ISOLATE(isolate); 1346 CHECK_ISOLATE(isolate);
1334 NoSafepointScope no_safepoint_scope; 1347 NoSafepointScope no_safepoint_scope;
1335 return isolate->message_handler()->is_paused_on_start(); 1348 return isolate->message_handler()->is_paused_on_start();
1349 #endif
1336 } 1350 }
1337 1351
1338 DART_EXPORT void Dart_SetPausedOnStart(bool paused) { 1352 DART_EXPORT void Dart_SetPausedOnStart(bool paused) {
1353 #if defined(PRODUCT)
1354 if (paused) {
1355 FATAL1("%s(true) is not supported in a PRODUCT build", CURRENT_FUNC);
1356 }
1357 #else
1339 Isolate* isolate = Isolate::Current(); 1358 Isolate* isolate = Isolate::Current();
1340 CHECK_ISOLATE(isolate); 1359 CHECK_ISOLATE(isolate);
1341 NoSafepointScope no_safepoint_scope; 1360 NoSafepointScope no_safepoint_scope;
1342 if (isolate->message_handler()->is_paused_on_start() != paused) { 1361 if (isolate->message_handler()->is_paused_on_start() != paused) {
1343 isolate->message_handler()->PausedOnStart(paused); 1362 isolate->message_handler()->PausedOnStart(paused);
1344 } 1363 }
1364 #endif
1345 } 1365 }
1346 1366
1347 DART_EXPORT bool Dart_ShouldPauseOnExit() { 1367 DART_EXPORT bool Dart_ShouldPauseOnExit() {
1368 #if defined(PRODUCT)
1369 return false;
1370 #else
1348 Isolate* isolate = Isolate::Current(); 1371 Isolate* isolate = Isolate::Current();
1349 CHECK_ISOLATE(isolate); 1372 CHECK_ISOLATE(isolate);
1350 NoSafepointScope no_safepoint_scope; 1373 NoSafepointScope no_safepoint_scope;
1351 return isolate->message_handler()->should_pause_on_exit(); 1374 return isolate->message_handler()->should_pause_on_exit();
1375 #endif
1352 } 1376 }
1353 1377
1354 DART_EXPORT void Dart_SetShouldPauseOnExit(bool should_pause) { 1378 DART_EXPORT void Dart_SetShouldPauseOnExit(bool should_pause) {
1379 #if defined(PRODUCT)
1380 if (should_pause) {
1381 FATAL1("%s(true) is not supported in a PRODUCT build", CURRENT_FUNC);
1382 }
1383 #else
1355 Isolate* isolate = Isolate::Current(); 1384 Isolate* isolate = Isolate::Current();
1356 CHECK_ISOLATE(isolate); 1385 CHECK_ISOLATE(isolate);
1357 NoSafepointScope no_safepoint_scope; 1386 NoSafepointScope no_safepoint_scope;
1358 return isolate->message_handler()->set_should_pause_on_exit(should_pause); 1387 isolate->message_handler()->set_should_pause_on_exit(should_pause);
1388 #endif
1359 } 1389 }
1360 1390
1361 DART_EXPORT bool Dart_IsPausedOnExit() { 1391 DART_EXPORT bool Dart_IsPausedOnExit() {
1392 #if defined(PRODUCT)
1393 return false;
1394 #else
1362 Isolate* isolate = Isolate::Current(); 1395 Isolate* isolate = Isolate::Current();
1363 CHECK_ISOLATE(isolate); 1396 CHECK_ISOLATE(isolate);
1364 NoSafepointScope no_safepoint_scope; 1397 NoSafepointScope no_safepoint_scope;
1365 return isolate->message_handler()->is_paused_on_exit(); 1398 return isolate->message_handler()->is_paused_on_exit();
1399 #endif
1366 } 1400 }
1367 1401
1368 DART_EXPORT void Dart_SetPausedOnExit(bool paused) { 1402 DART_EXPORT void Dart_SetPausedOnExit(bool paused) {
1403 #if defined(PRODUCT)
1404 if (paused) {
1405 FATAL1("%s(true) is not supported in a PRODUCT build", CURRENT_FUNC);
1406 }
1407 #else
1369 Isolate* isolate = Isolate::Current(); 1408 Isolate* isolate = Isolate::Current();
1370 CHECK_ISOLATE(isolate); 1409 CHECK_ISOLATE(isolate);
1371 NoSafepointScope no_safepoint_scope; 1410 NoSafepointScope no_safepoint_scope;
1372 if (isolate->message_handler()->is_paused_on_exit() != paused) { 1411 if (isolate->message_handler()->is_paused_on_exit() != paused) {
1373 isolate->message_handler()->PausedOnExit(paused); 1412 isolate->message_handler()->PausedOnExit(paused);
1374 } 1413 }
1414 #endif
1375 } 1415 }
1376 1416
1377 DART_EXPORT void Dart_SetStickyError(Dart_Handle error) { 1417 DART_EXPORT void Dart_SetStickyError(Dart_Handle error) {
1378 Thread* thread = Thread::Current(); 1418 Thread* thread = Thread::Current();
1379 DARTSCOPE(thread); 1419 DARTSCOPE(thread);
1380 Isolate* isolate = thread->isolate(); 1420 Isolate* isolate = thread->isolate();
1381 CHECK_ISOLATE(isolate); 1421 CHECK_ISOLATE(isolate);
1382 NoSafepointScope no_safepoint_scope; 1422 NoSafepointScope no_safepoint_scope;
1383 if ((isolate->sticky_error() != Error::null()) && !::Dart_IsNull(error)) { 1423 if ((isolate->sticky_error() != Error::null()) && !::Dart_IsNull(error)) {
1384 FATAL1("%s expects there to be no sticky error.", CURRENT_FUNC); 1424 FATAL1("%s expects there to be no sticky error.", CURRENT_FUNC);
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 TransitionNativeToVM transition(T); 1658 TransitionNativeToVM transition(T);
1619 if (I->message_handler()->HandleAllMessages() != MessageHandler::kOK) { 1659 if (I->message_handler()->HandleAllMessages() != MessageHandler::kOK) {
1620 Dart_Handle error = Api::NewHandle(T, T->sticky_error()); 1660 Dart_Handle error = Api::NewHandle(T, T->sticky_error());
1621 T->clear_sticky_error(); 1661 T->clear_sticky_error();
1622 return error; 1662 return error;
1623 } 1663 }
1624 return Api::Success(); 1664 return Api::Success();
1625 } 1665 }
1626 1666
1627 DART_EXPORT bool Dart_HandleServiceMessages() { 1667 DART_EXPORT bool Dart_HandleServiceMessages() {
1668 #if defined(PRODUCT)
1669 return true;
1670 #else
1628 Thread* T = Thread::Current(); 1671 Thread* T = Thread::Current();
1629 Isolate* I = T->isolate(); 1672 Isolate* I = T->isolate();
1630 CHECK_API_SCOPE(T); 1673 CHECK_API_SCOPE(T);
1631 CHECK_CALLBACK_STATE(T); 1674 CHECK_CALLBACK_STATE(T);
1632 API_TIMELINE_DURATION; 1675 API_TIMELINE_DURATION;
1633 TransitionNativeToVM transition(T); 1676 TransitionNativeToVM transition(T);
1634 ASSERT(I->GetAndClearResumeRequest() == false); 1677 ASSERT(I->GetAndClearResumeRequest() == false);
1635 MessageHandler::MessageStatus status = 1678 MessageHandler::MessageStatus status =
1636 I->message_handler()->HandleOOBMessages(); 1679 I->message_handler()->HandleOOBMessages();
1637 bool resume = I->GetAndClearResumeRequest(); 1680 bool resume = I->GetAndClearResumeRequest();
1638 return (status != MessageHandler::kOK) || resume; 1681 return (status != MessageHandler::kOK) || resume;
1682 #endif
1639 } 1683 }
1640 1684
1641 DART_EXPORT bool Dart_HasServiceMessages() { 1685 DART_EXPORT bool Dart_HasServiceMessages() {
1686 #if defined(PRODUCT)
1687 return false;
1688 #else
1642 Isolate* isolate = Isolate::Current(); 1689 Isolate* isolate = Isolate::Current();
1643 ASSERT(isolate); 1690 ASSERT(isolate);
1644 NoSafepointScope no_safepoint_scope; 1691 NoSafepointScope no_safepoint_scope;
1645 return isolate->message_handler()->HasOOBMessages(); 1692 return isolate->message_handler()->HasOOBMessages();
1693 #endif
1646 } 1694 }
1647 1695
1648 DART_EXPORT bool Dart_HasLivePorts() { 1696 DART_EXPORT bool Dart_HasLivePorts() {
1649 Isolate* isolate = Isolate::Current(); 1697 Isolate* isolate = Isolate::Current();
1650 ASSERT(isolate); 1698 ASSERT(isolate);
1651 NoSafepointScope no_safepoint_scope; 1699 NoSafepointScope no_safepoint_scope;
1652 return isolate->message_handler()->HasLivePorts(); 1700 return isolate->message_handler()->HasLivePorts();
1653 } 1701 }
1654 1702
1655 static uint8_t* malloc_allocator(uint8_t* ptr, 1703 static uint8_t* malloc_allocator(uint8_t* ptr,
(...skipping 5014 matching lines...) Expand 10 before | Expand all | Expand 10 after
6670 #endif 6718 #endif
6671 } 6719 }
6672 6720
6673 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { 6721 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) {
6674 #ifndef PRODUCT 6722 #ifndef PRODUCT
6675 Profiler::DumpStackTrace(context); 6723 Profiler::DumpStackTrace(context);
6676 #endif 6724 #endif
6677 } 6725 }
6678 6726
6679 } // namespace dart 6727 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698