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

Unified Diff: runtime/vm/isolate.cc

Issue 8918028: If an unhandled exception occurs in Dart_RunLoop, pass it out to the caller. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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
« no previous file with comments | « runtime/vm/isolate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.cc
===================================================================
--- runtime/vm/isolate.cc (revision 2436)
+++ runtime/vm/isolate.cc (working copy)
@@ -11,6 +11,7 @@
#include "vm/code_index_table.h"
#include "vm/compiler_stats.h"
#include "vm/dart_api_state.h"
+#include "vm/dart_entry.h"
#include "vm/debugger.h"
#include "vm/debuginfo.h"
#include "vm/heap.h"
@@ -242,7 +243,22 @@
}
-void Isolate::StandardRunLoop() {
+static RawInstance* DeserializeMessage(void* data) {
+ // Create a snapshot object using the buffer.
+ const Snapshot* snapshot = Snapshot::SetupFromBuffer(data);
+ ASSERT(snapshot->IsMessageSnapshot());
+
+ // Read object back from the snapshot.
+ Isolate* isolate = Isolate::Current();
+ SnapshotReader reader(snapshot, isolate->heap(), isolate->object_store());
+ Instance& instance = Instance::Handle();
+ instance ^= reader.ReadObject();
+ return instance.raw();
+}
+
+
+
+RawObject* Isolate::StandardRunLoop() {
ASSERT(long_jump_base() != NULL);
ASSERT(post_message_callback() == &StandardPostMessageCallback);
ASSERT(close_port_callback() == &StandardClosePortCallback);
@@ -254,21 +270,20 @@
PortMessage* message = message_queue()->Dequeue(0);
if (message != NULL) {
- Dart_EnterScope();
- Dart_Handle result = Dart_HandleMessage(
- message->dest_port(), message->reply_port(), message->data());
- if (Dart_IsError(result)) {
- // TODO(turnidge): Consider passing this error out to
- // Dart_RunLoop so that the embedder can choose how to handle
- // it.
- fprintf(stderr, "%s\n", Dart_GetError(result));
- Dart_ExitScope();
- exit(255);
+ const Instance& msg =
+ Instance::Handle(DeserializeMessage(message->data()));
+ const Object& result = Object::Handle(
+ DartLibraryCalls::HandleMessage(
+ message->dest_port(), message->reply_port(), msg));
+ delete message;
+ if (result.IsUnhandledException()) {
+ return result.raw();
}
- Dart_ExitScope();
- delete message;
}
}
+
+ // Indicates success.
+ return Object::null();
}
« no previous file with comments | « runtime/vm/isolate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698