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

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

Issue 2223913002: Add an API for setting the sticky error (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: asiva review Created 4 years, 4 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/include/dart_api.h ('k') | runtime/vm/dart_api_impl_test.cc » ('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 "platform/assert.h" 9 #include "platform/assert.h"
10 #include "lib/stacktrace.h" 10 #include "lib/stacktrace.h"
(...skipping 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 DART_EXPORT void Dart_SetPausedOnExit(bool paused) { 1443 DART_EXPORT void Dart_SetPausedOnExit(bool paused) {
1444 Isolate* isolate = Isolate::Current(); 1444 Isolate* isolate = Isolate::Current();
1445 CHECK_ISOLATE(isolate); 1445 CHECK_ISOLATE(isolate);
1446 NoSafepointScope no_safepoint_scope; 1446 NoSafepointScope no_safepoint_scope;
1447 if (isolate->message_handler()->is_paused_on_exit() != paused) { 1447 if (isolate->message_handler()->is_paused_on_exit() != paused) {
1448 isolate->message_handler()->PausedOnExit(paused); 1448 isolate->message_handler()->PausedOnExit(paused);
1449 } 1449 }
1450 } 1450 }
1451 1451
1452 1452
1453 DART_EXPORT void Dart_SetStickyError(Dart_Handle error) {
1454 Thread* thread = Thread::Current();
1455 DARTSCOPE(thread);
1456 Isolate* isolate = thread->isolate();
1457 CHECK_ISOLATE(isolate);
1458 NoSafepointScope no_safepoint_scope;
1459 if (isolate->sticky_error() != Error::null()) {
1460 FATAL1("%s expects there to be no sticky error.", CURRENT_FUNC);
1461 }
1462 if (!Dart_IsUnhandledExceptionError(error)) {
1463 FATAL1("%s expects the error to be an unhandled exception error.",
1464 CURRENT_FUNC);
1465 }
1466 isolate->SetStickyError(
1467 Api::UnwrapErrorHandle(Z, error).raw());
1468 }
1469
1470
1471 DART_EXPORT bool Dart_HasStickyError() {
1472 Isolate* isolate = Isolate::Current();
1473 CHECK_ISOLATE(isolate);
1474 NoSafepointScope no_safepoint_scope;
1475 return isolate->sticky_error() != Error::null();
1476 }
1477
1478
1453 DART_EXPORT void Dart_ExitIsolate() { 1479 DART_EXPORT void Dart_ExitIsolate() {
1454 Thread* T = Thread::Current(); 1480 Thread* T = Thread::Current();
1455 CHECK_ISOLATE(T->isolate()); 1481 CHECK_ISOLATE(T->isolate());
1456 // The Thread structure is disassociated from the isolate, we do the 1482 // The Thread structure is disassociated from the isolate, we do the
1457 // safepoint transition explicity here instead of using the TransitionXXX 1483 // safepoint transition explicity here instead of using the TransitionXXX
1458 // scope objects as the original transition happened outside this scope in 1484 // scope objects as the original transition happened outside this scope in
1459 // Dart_EnterIsolate/Dart_CreateIsolate. 1485 // Dart_EnterIsolate/Dart_CreateIsolate.
1460 ASSERT(T->execution_state() == Thread::kThreadInNative); 1486 ASSERT(T->execution_state() == Thread::kThreadInNative);
1461 T->ExitSafepoint(); 1487 T->ExitSafepoint();
1462 T->set_execution_state(Thread::kThreadInVM); 1488 T->set_execution_state(Thread::kThreadInVM);
(...skipping 5099 matching lines...) Expand 10 before | Expand all | Expand 10 after
6562 6588
6563 DART_EXPORT bool Dart_IsPrecompiledRuntime() { 6589 DART_EXPORT bool Dart_IsPrecompiledRuntime() {
6564 #if defined(DART_PRECOMPILED_RUNTIME) 6590 #if defined(DART_PRECOMPILED_RUNTIME)
6565 return true; 6591 return true;
6566 #else 6592 #else
6567 return false; 6593 return false;
6568 #endif 6594 #endif
6569 } 6595 }
6570 6596
6571 } // namespace dart 6597 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698