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

Unified Diff: runtime/lib/isolate.cc

Issue 11413101: Added support for isolate unhandled exceptions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: runtime/lib/isolate.cc
diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc
index 7219bda38b16d78209b6de077e7da862ef5cc014..3bb05c39c41f455c29fee41a908089792657e005 100644
--- a/runtime/lib/isolate.cc
+++ b/runtime/lib/isolate.cc
@@ -91,8 +91,7 @@ static void ShutdownIsolate(uword parameter) {
Error& error = Error::Handle();
error = isolate->object_store()->sticky_error();
if (!error.IsNull()) {
- OS::PrintErr("%s\n", error.ToErrorCString());
- exit(255);
+ OS::PrintErr("in ShutdownIsolate: %s\n", error.ToErrorCString());
}
}
{
@@ -388,6 +387,14 @@ static RawObject* Spawn(NativeArguments* arguments, SpawnState* state) {
Exceptions::PropagateError(Error::Cast(port));
}
+ // If specified, set the new isolate's uncaught exception handler.
+ ASSERT(arguments->NativeArgCount() == 2);
+ const Object& arg = Object::Handle(arguments->NativeArgAt(1));
+ if (!arg.IsNull()) {
+ const Instance& callback = Instance::Cast(arg);
+ state->isolate()->object_store()->set_unhandled_exception_closure(callback);
+ }
+
// Start the new isolate.
state->isolate()->set_spawn_data(reinterpret_cast<uword>(state));
state->isolate()->message_handler()->Run(
@@ -398,7 +405,7 @@ static RawObject* Spawn(NativeArguments* arguments, SpawnState* state) {
}
-DEFINE_NATIVE_ENTRY(isolate_spawnFunction, 1) {
+DEFINE_NATIVE_ENTRY(isolate_spawnFunction, 2) {
GET_NATIVE_ARGUMENT(Instance, closure, arguments->NativeArgAt(0));
bool throw_exception = false;
Function& func = Function::Handle();
@@ -427,7 +434,7 @@ DEFINE_NATIVE_ENTRY(isolate_spawnFunction, 1) {
}
-DEFINE_NATIVE_ENTRY(isolate_spawnUri, 1) {
+DEFINE_NATIVE_ENTRY(isolate_spawnUri, 2) {
GET_NATIVE_ARGUMENT(String, uri, arguments->NativeArgAt(0));
// Canonicalize the uri with respect to the current isolate.

Powered by Google App Engine
This is Rietveld 408576698