Chromium Code Reviews| Index: runtime/lib/isolate.cc |
| =================================================================== |
| --- runtime/lib/isolate.cc (revision 3416) |
| +++ runtime/lib/isolate.cc (working copy) |
| @@ -80,7 +80,8 @@ |
| } |
| -RawInstance* ReceivePortCreate(intptr_t port_id) { |
| +// TODO(turnidge): Move to DartLibraryCalls. |
| +RawObject* ReceivePortCreate(intptr_t port_id) { |
| const String& class_name = |
| String::Handle(String::NewSymbol("ReceivePortImpl")); |
| const String& function_name = |
| @@ -96,18 +97,17 @@ |
| Resolver::kIsQualified)); |
| GrowableArray<const Object*> arguments(kNumArguments); |
| arguments.Add(&Integer::Handle(Integer::New(port_id))); |
| - const Instance& result = Instance::Handle( |
| + const Object& result = Object::Handle( |
| DartEntry::InvokeStatic(function, arguments, kNoArgumentNames)); |
| - if (result.IsError()) { |
| - ProcessError(result); |
| - } else { |
| + if (result.IsInstance()) { |
|
siva
2012/01/31 00:52:34
Why not
if (!result.IsError()) {
PortMap::SetLiv
turnidge
2012/01/31 21:56:31
Done.
|
| PortMap::SetLive(port_id); |
| } |
| return result.raw(); |
| } |
| -static RawInstance* SendPortCreate(intptr_t port_id) { |
| +// TODO(turnidge): Move to DartLibraryCalls. |
| +static RawObject* 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; |
| @@ -121,7 +121,7 @@ |
| Resolver::kIsQualified)); |
| GrowableArray<const Object*> arguments(kNumArguments); |
| arguments.Add(&Integer::Handle(Integer::New(port_id))); |
| - const Instance& result = Instance::Handle( |
| + const Object& result = Object::Handle( |
| DartEntry::InvokeStatic(function, arguments, kNoArgumentNames)); |
| return result.raw(); |
| } |
| @@ -183,7 +183,10 @@ |
| // TODO(iposva): Proper error checking here. |
| ASSERT(!target_function.IsNull()); |
| // TODO(iposva): Allocate the proper port number here. |
| - const Instance& local_port = Instance::Handle(ReceivePortCreate(port_id)); |
| + const Object& local_port = Object::Handle(ReceivePortCreate(port_id)); |
| + if (local_port.IsError()) { |
| + ProcessError(local_port); |
| + } |
| GrowableArray<const Object*> arguments(1); |
| arguments.Add(&local_port); |
| const Array& kNoArgumentNames = Array::Handle(); |
| @@ -325,16 +328,15 @@ |
| library_url, |
| class_name); |
| } |
| - const Instance& port = Instance::Handle(SendPortCreate(port_id)); |
| + |
| + // 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)); |
| if (port.IsError()) { |
| - if (port.IsUnhandledException()) { |
| - ThrowErrorException(Exceptions::kInternalError, |
| - "Unable to create send port to isolate", |
| - library_url, |
| - class_name); |
| - } else { |
| - ProcessError(port); |
| - } |
| + Error& error = Error::Handle(); |
| + error ^= port.raw(); |
| + Exceptions::PropagateError(error); |
| } |
| arguments->SetReturn(port); |
| } |
| @@ -343,7 +345,12 @@ |
| DEFINE_NATIVE_ENTRY(ReceivePortImpl_factory, 1) { |
| ASSERT(AbstractTypeArguments::CheckedHandle(arguments->At(0)).IsNull()); |
| intptr_t port_id = PortMap::CreatePort(); |
| - const Instance& port = Instance::Handle(ReceivePortCreate(port_id)); |
| + const Object& port = Object::Handle(ReceivePortCreate(port_id)); |
| + if (port.IsError()) { |
| + Error& error = Error::Handle(); |
| + error ^= port.raw(); |
| + Exceptions::PropagateError(error); |
| + } |
| arguments->SetReturn(port); |
| } |