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

Unified Diff: vm/isolate.cc

Issue 11475012: Return an unhandled exception error on an OOM or other errors while (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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 | « vm/exceptions.cc ('k') | vm/snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/isolate.cc
===================================================================
--- vm/isolate.cc (revision 15761)
+++ vm/isolate.cc (working copy)
@@ -50,6 +50,8 @@
virtual Isolate* GetIsolate() const { return isolate_; }
private:
+ bool ProcessUnhandledException(const Object& result);
+
Isolate* isolate_;
};
@@ -89,6 +91,10 @@
SnapshotReader reader(message->data(), message->len(),
Snapshot::kMessage, Isolate::Current());
const Object& msg_obj = Object::Handle(reader.ReadObject());
+ if (msg_obj.IsError()) {
+ // An error occurred while reading the message.
+ return ProcessUnhandledException(msg_obj);
+ }
if (!msg_obj.IsNull() && !msg_obj.IsInstance()) {
// TODO(turnidge): We need to decide what an isolate does with
// malformed messages. If they (eventually) come from a remote
@@ -110,17 +116,8 @@
DartLibraryCalls::HandleMessage(
message->dest_port(), message->reply_port(), msg));
delete message;
- if (result.IsError() || result.IsUnhandledException()) {
- if (result.IsError()) {
- isolate_->object_store()->set_sticky_error(Error::Cast(result));
- }
- if (Isolate::UnhandledExceptionCallback() != NULL) {
- Dart_EnterScope();
- Dart_Handle error = Api::NewHandle(isolate_, result.raw());
- (Isolate::UnhandledExceptionCallback())(error);
- Dart_ExitScope();
- }
- return false;
+ if (result.IsError()) {
+ return ProcessUnhandledException(result);
}
ASSERT(result.IsNull());
}
@@ -140,6 +137,19 @@
}
+bool IsolateMessageHandler::ProcessUnhandledException(const Object& result) {
+ isolate_->object_store()->set_sticky_error(Error::Cast(result));
+ // Invoke the dart unhandled exception callback if there is one.
+ if (Isolate::UnhandledExceptionCallback() != NULL) {
+ Dart_EnterScope();
+ Dart_Handle error = Api::NewHandle(isolate_, result.raw());
+ (Isolate::UnhandledExceptionCallback())(error);
+ Dart_ExitScope();
+ }
+ return false;
+}
+
+
#if defined(DEBUG)
// static
void BaseIsolate::AssertCurrent(BaseIsolate* isolate) {
« no previous file with comments | « vm/exceptions.cc ('k') | vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698