| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
| 6 #include "bin/directory.h" | 6 #include "bin/directory.h" |
| 7 #include "bin/file.h" | 7 #include "bin/file.h" |
| 8 #include "bin/io_buffer.h" | 8 #include "bin/io_buffer.h" |
| 9 #include "bin/io_service.h" | 9 #include "bin/io_service.h" |
| 10 #include "bin/secure_socket.h" | 10 #include "bin/secure_socket.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 namespace dart { | 22 namespace dart { |
| 23 namespace bin { | 23 namespace bin { |
| 24 | 24 |
| 25 #define CASE_REQUEST(type, method, id) \ | 25 #define CASE_REQUEST(type, method, id) \ |
| 26 case IOService::k##type##method##Request: \ | 26 case IOService::k##type##method##Request: \ |
| 27 response = type::method##Request(data); \ | 27 response = type::method##Request(data); \ |
| 28 break; | 28 break; |
| 29 | 29 |
| 30 void IOServiceCallback(Dart_Port dest_port_id, | 30 void IOServiceCallback(Dart_Port dest_port_id, |
| 31 Dart_Port reply_port_id, | |
| 32 Dart_CObject* message) { | 31 Dart_CObject* message) { |
| 32 Dart_Port reply_port_id; |
| 33 CObject* response = CObject::IllegalArgumentError(); | 33 CObject* response = CObject::IllegalArgumentError(); |
| 34 CObjectArray request(message); | 34 CObjectArray request(message); |
| 35 if (message->type == Dart_CObject_kArray && | 35 if (message->type == Dart_CObject_kArray && |
| 36 request.Length() == 3 && | 36 request.Length() == 4 && |
| 37 request[0]->IsInt32() && | 37 request[0]->IsInt32() && |
| 38 request[1]->IsInt32() && | 38 request[1]->IsSendPort() && |
| 39 request[2]->IsArray()) { | 39 request[2]->IsInt32() && |
| 40 request[3]->IsArray()) { |
| 40 CObjectInt32 message_id(request[0]); | 41 CObjectInt32 message_id(request[0]); |
| 41 CObjectInt32 request_id(request[1]); | 42 CObjectSendPort reply_port(request[1]); |
| 42 CObjectArray data(request[2]); | 43 CObjectInt32 request_id(request[2]); |
| 44 CObjectArray data(request[3]); |
| 45 reply_port_id = reply_port.Value(); |
| 43 switch (request_id.Value()) { | 46 switch (request_id.Value()) { |
| 44 IO_SERVICE_REQUEST_LIST(CASE_REQUEST); | 47 IO_SERVICE_REQUEST_LIST(CASE_REQUEST); |
| 45 default: | 48 default: |
| 46 UNREACHABLE(); | 49 UNREACHABLE(); |
| 47 } | 50 } |
| 48 } | 51 } |
| 49 | 52 |
| 50 CObjectArray result(CObject::NewArray(2)); | 53 CObjectArray result(CObject::NewArray(2)); |
| 51 result.SetAt(0, request[0]); | 54 result.SetAt(0, request[0]); |
| 52 result.SetAt(1, response); | 55 result.SetAt(1, response); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 68 if (service_port != ILLEGAL_PORT) { | 71 if (service_port != ILLEGAL_PORT) { |
| 69 // Return a send port for the service port. | 72 // Return a send port for the service port. |
| 70 Dart_Handle send_port = Dart_NewSendPort(service_port); | 73 Dart_Handle send_port = Dart_NewSendPort(service_port); |
| 71 Dart_SetReturnValue(args, send_port); | 74 Dart_SetReturnValue(args, send_port); |
| 72 } | 75 } |
| 73 } | 76 } |
| 74 | 77 |
| 75 | 78 |
| 76 } // namespace bin | 79 } // namespace bin |
| 77 } // namespace dart | 80 } // namespace dart |
| 78 | |
| OLD | NEW |