Chromium Code Reviews| Index: runtime/vm/dart_api_impl.cc |
| diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc |
| index aff9955d0f6066674e0b6dc52f2389bf321cc290..567fc848b588b6ebfb54a80fe204b0f24c431ac3 100644 |
| --- a/runtime/vm/dart_api_impl.cc |
| +++ b/runtime/vm/dart_api_impl.cc |
| @@ -1450,6 +1450,31 @@ DART_EXPORT void Dart_SetPausedOnExit(bool paused) { |
| } |
| +DART_EXPORT void Dart_SetStickyError(Dart_Handle error) { |
| + Thread* thread = Thread::Current(); |
| + Isolate* isolate = thread->isolate(); |
| + CHECK_ISOLATE(isolate); |
|
siva
2016/08/08 17:53:45
Probably better to create a scope here as we will
Cutch
2016/08/08 19:14:30
Done.
|
| + NoSafepointScope no_safepoint_scope; |
| + if (isolate->sticky_error() != Error::null()) { |
| + FATAL1("%s expects there to be no sticky error.", CURRENT_FUNC); |
| + } |
| + if (!Dart_IsUnhandledExceptionError(error)) { |
| + FATAL1("%s expects the error to be an unhandled exception error.", |
| + CURRENT_FUNC); |
| + } |
| + isolate->SetStickyError( |
| + Api::UnwrapErrorHandle(thread->zone(), error).raw()); |
|
siva
2016/08/08 17:53:45
you could use Z here instead of thread->zone() to
Cutch
2016/08/08 19:14:30
Done.
|
| +} |
| + |
| + |
| +DART_EXPORT bool Dart_HasStickyError() { |
| + Isolate* isolate = Isolate::Current(); |
| + CHECK_ISOLATE(isolate); |
| + NoSafepointScope no_safepoint_scope; |
| + return isolate->sticky_error() != Error::null(); |
| +} |
| + |
| + |
| DART_EXPORT void Dart_ExitIsolate() { |
| Thread* T = Thread::Current(); |
| CHECK_ISOLATE(T->isolate()); |