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

Unified Diff: runtime/vm/dart_api_impl.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/tests/vm/vm.status ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
===================================================================
--- runtime/vm/dart_api_impl.cc (revision 2436)
+++ runtime/vm/dart_api_impl.cc (working copy)
@@ -678,6 +678,30 @@
}
+DART_EXPORT Dart_Handle Dart_RunLoop() {
+ Isolate* isolate = Isolate::Current();
+ DARTSCOPE(isolate);
+
+ LongJump* base = isolate->long_jump_base();
+ LongJump jump;
+ Dart_Handle result;
+ isolate->set_long_jump_base(&jump);
+ if (setjmp(*jump.Set()) == 0) {
+ const Object& obj = Object::Handle(isolate->StandardRunLoop());
+ if (obj.IsUnhandledException()) {
+ result = Api::ErrorFromException(obj);
+ } else {
+ ASSERT(obj.IsNull());
+ result = Api::Success();
+ }
+ } else {
+ SetupErrorResult(&result);
+ }
+ isolate->set_long_jump_base(base);
+ return result;
+}
+
+
static RawInstance* DeserializeMessage(void* data) {
// Create a snapshot object using the buffer.
const Snapshot* snapshot = Snapshot::SetupFromBuffer(data);
@@ -696,28 +720,12 @@
Dart_Port reply_port_id,
Dart_Message dart_message) {
DARTSCOPE(Isolate::Current());
-
const Instance& msg = Instance::Handle(DeserializeMessage(dart_message));
- const String& class_name =
- String::Handle(String::NewSymbol("ReceivePortImpl"));
- const String& function_name =
- String::Handle(String::NewSymbol("_handleMessage"));
- const int kNumArguments = 3;
- const Array& kNoArgumentNames = Array::Handle();
- const Function& function = Function::Handle(
- Resolver::ResolveStatic(Library::Handle(Library::CoreLibrary()),
- class_name,
- function_name,
- kNumArguments,
- kNoArgumentNames,
- Resolver::kIsQualified));
- GrowableArray<const Object*> arguments(kNumArguments);
- arguments.Add(&Integer::Handle(Integer::New(dest_port_id)));
- arguments.Add(&Integer::Handle(Integer::New(reply_port_id)));
- arguments.Add(&msg);
- // TODO(turnidge): This call should be wrapped in a longjmp
- const Object& result = Object::Handle(
- DartEntry::InvokeStatic(function, arguments, kNoArgumentNames));
+ // TODO(turnidge): Should this call be wrapped in a longjmp?
+ const Object& result =
+ Object::Handle(DartLibraryCalls::HandleMessage(dest_port_id,
+ reply_port_id,
+ msg));
if (result.IsUnhandledException()) {
return Api::ErrorFromException(result);
}
@@ -726,25 +734,6 @@
}
-DART_EXPORT Dart_Handle Dart_RunLoop() {
- Isolate* isolate = Isolate::Current();
- DARTSCOPE(isolate);
-
- LongJump* base = isolate->long_jump_base();
- LongJump jump;
- Dart_Handle result;
- isolate->set_long_jump_base(&jump);
- if (setjmp(*jump.Set()) == 0) {
- isolate->StandardRunLoop();
- result = Api::Success();
- } else {
- SetupErrorResult(&result);
- }
- isolate->set_long_jump_base(base);
- return result;
-}
-
-
DART_EXPORT bool Dart_HasLivePorts() {
Isolate* isolate = Isolate::Current();
ASSERT(isolate);
« no previous file with comments | « runtime/tests/vm/vm.status ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698