| Index: runtime/lib/isolate.cc
|
| ===================================================================
|
| --- runtime/lib/isolate.cc (revision 3821)
|
| +++ runtime/lib/isolate.cc (working copy)
|
| @@ -81,8 +81,7 @@
|
| }
|
|
|
|
|
| -// TODO(turnidge): Move to DartLibraryCalls.
|
| -RawObject* ReceivePortCreate(intptr_t port_id) {
|
| +RawInstance* ReceivePortCreate(intptr_t port_id) {
|
| const String& class_name =
|
| String::Handle(String::NewSymbol("ReceivePortImpl"));
|
| const String& function_name =
|
| @@ -98,17 +97,18 @@
|
| Resolver::kIsQualified));
|
| GrowableArray<const Object*> arguments(kNumArguments);
|
| arguments.Add(&Integer::Handle(Integer::New(port_id)));
|
| - const Object& result = Object::Handle(
|
| + const Instance& result = Instance::Handle(
|
| DartEntry::InvokeStatic(function, arguments, kNoArgumentNames));
|
| - if (!result.IsError()) {
|
| + if (result.IsError()) {
|
| + ProcessError(result);
|
| + } else {
|
| PortMap::SetLive(port_id);
|
| }
|
| return result.raw();
|
| }
|
|
|
|
|
| -// TODO(turnidge): Move to DartLibraryCalls.
|
| -static RawObject* SendPortCreate(intptr_t port_id) {
|
| +static RawInstance* SendPortCreate(intptr_t port_id) {
|
| const String& class_name = String::Handle(String::NewSymbol("SendPortImpl"));
|
| const String& function_name = String::Handle(String::NewSymbol("_create"));
|
| const int kNumArguments = 1;
|
| @@ -122,7 +122,7 @@
|
| Resolver::kIsQualified));
|
| GrowableArray<const Object*> arguments(kNumArguments);
|
| arguments.Add(&Integer::Handle(Integer::New(port_id)));
|
| - const Object& result = Object::Handle(
|
| + const Instance& result = Instance::Handle(
|
| DartEntry::InvokeStatic(function, arguments, kNoArgumentNames));
|
| return result.raw();
|
| }
|
| @@ -184,10 +184,7 @@
|
| // TODO(iposva): Proper error checking here.
|
| ASSERT(!target_function.IsNull());
|
| // TODO(iposva): Allocate the proper port number here.
|
| - const Object& local_port = Object::Handle(ReceivePortCreate(port_id));
|
| - if (local_port.IsError()) {
|
| - ProcessError(local_port);
|
| - }
|
| + const Instance& local_port = Instance::Handle(ReceivePortCreate(port_id));
|
| GrowableArray<const Object*> arguments(1);
|
| arguments.Add(&local_port);
|
| const Array& kNoArgumentNames = Array::Handle();
|
| @@ -330,13 +327,16 @@
|
| library_url,
|
| class_name);
|
| }
|
| -
|
| - // TODO(turnidge): Move this code up before we launch the new
|
| - // thread. That way we won't have a thread hanging around that we
|
| - // can't talk to.
|
| - const Object& port = Object::Handle(SendPortCreate(port_id));
|
| + const Instance& port = Instance::Handle(SendPortCreate(port_id));
|
| if (port.IsError()) {
|
| - Exceptions::PropagateError(port);
|
| + if (port.IsUnhandledException()) {
|
| + ThrowErrorException(Exceptions::kInternalError,
|
| + "Unable to create send port to isolate",
|
| + library_url,
|
| + class_name);
|
| + } else {
|
| + ProcessError(port);
|
| + }
|
| }
|
| arguments->SetReturn(port);
|
| }
|
| @@ -346,10 +346,7 @@
|
| ASSERT(AbstractTypeArguments::CheckedHandle(arguments->At(0)).IsNull());
|
| intptr_t port_id =
|
| PortMap::CreatePort(arguments->isolate()->message_handler());
|
| - const Object& port = Object::Handle(ReceivePortCreate(port_id));
|
| - if (port.IsError()) {
|
| - Exceptions::PropagateError(port);
|
| - }
|
| + const Instance& port = Instance::Handle(ReceivePortCreate(port_id));
|
| arguments->SetReturn(port);
|
| }
|
|
|
|
|