Chromium Code Reviews| Index: runtime/vm/dart_api_impl.cc |
| =================================================================== |
| --- runtime/vm/dart_api_impl.cc (revision 4295) |
| +++ runtime/vm/dart_api_impl.cc (working copy) |
| @@ -650,23 +650,30 @@ |
| if (message == NULL) { |
| break; |
| } |
| + const Instance& msg = |
| + Instance::Handle(DeserializeMessage(message->data())); |
| priority = message->priority(); |
| if (priority == Message::kOOBPriority) { |
| - // TODO(turnidge): Out of band messages will not go through the |
| - // regular message handler. Instead they will be dispatched to |
| - // special vm code. Implement. |
| - UNIMPLEMENTED(); |
| + // For now the only OOB messages are Mirrors messages. |
| + const Object& result = Object::Handle( |
| + DartLibraryCalls::HandleMirrorsMessage( |
| + message->dest_port(), message->reply_port(), msg)); |
| + delete message; |
| + if (result.IsError()) { |
| + // TODO(turnidge): Propagating the error is probably wrong here. |
| + return Api::NewLocalHandle(result); |
| + } |
| + ASSERT(result.IsNull()); |
|
siva
2012/02/18 01:25:55
There seems to be some duplication here and in cod
turnidge
2012/03/07 20:00:14
Yes. There is duplication. Can I clean it up dur
siva
2012/03/08 22:24:02
Ok (maybe add a TODO at the duplication points).
turnidge
2012/03/08 22:50:51
Done.
|
| + } else { |
| + const Object& result = Object::Handle( |
| + DartLibraryCalls::HandleMessage( |
| + message->dest_port(), message->reply_port(), msg)); |
| + delete message; |
| + if (result.IsError()) { |
| + return Api::NewLocalHandle(result); |
| + } |
| + ASSERT(result.IsNull()); |
| } |
| - 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.IsError()) { |
| - return Api::NewLocalHandle(result); |
| - } |
| - ASSERT(result.IsNull()); |
| } while (priority >= Message::kOOBPriority); |
| return Api::Success(); |
| } |
| @@ -759,23 +766,7 @@ |
| DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id) { |
| Isolate* isolate = Isolate::Current(); |
| DARTSCOPE(isolate); |
| - const String& class_name = String::Handle(String::NewSymbol("SendPortImpl")); |
| - const String& function_name = String::Handle(String::NewSymbol("_create")); |
| - const int kNumArguments = 1; |
| - const Array& kNoArgumentNames = Array::Handle(); |
| - // TODO(turnidge): Consider adding a helper function to make |
| - // function resolution by class name and function name more concise. |
| - 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(port_id))); |
| - const Object& result = Object::Handle( |
| - DartEntry::InvokeStatic(function, arguments, kNoArgumentNames)); |
| + const Object& result = Object::Handle(DartLibraryCalls::NewSendPort(port_id)); |
| return Api::NewLocalHandle(result); |
| } |