| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 switch (request_id.Value()) { | 46 switch (request_id.Value()) { |
| 47 IO_SERVICE_REQUEST_LIST(CASE_REQUEST); | 47 IO_SERVICE_REQUEST_LIST(CASE_REQUEST); |
| 48 default: | 48 default: |
| 49 UNREACHABLE(); | 49 UNREACHABLE(); |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 CObjectArray result(CObject::NewArray(2)); | 53 CObjectArray result(CObject::NewArray(2)); |
| 54 result.SetAt(0, request[0]); | 54 result.SetAt(0, request[0]); |
| 55 result.SetAt(1, response); | 55 result.SetAt(1, response); |
| 56 ASSERT(reply_port_id != ILLEGAL_PORT); |
| 56 Dart_PostCObject(reply_port_id, result.AsApiCObject()); | 57 Dart_PostCObject(reply_port_id, result.AsApiCObject()); |
| 57 } | 58 } |
| 58 | 59 |
| 59 | 60 |
| 60 Dart_Port IOService::GetServicePort() { | 61 Dart_Port IOService::GetServicePort() { |
| 61 Dart_Port result = Dart_NewNativePort("IOService", | 62 Dart_Port result = Dart_NewNativePort("IOService", |
| 62 IOServiceCallback, | 63 IOServiceCallback, |
| 63 true); | 64 true); |
| 64 return result; | 65 return result; |
| 65 } | 66 } |
| 66 | 67 |
| 67 | 68 |
| 68 void FUNCTION_NAME(IOService_NewServicePort)(Dart_NativeArguments args) { | 69 void FUNCTION_NAME(IOService_NewServicePort)(Dart_NativeArguments args) { |
| 69 Dart_SetReturnValue(args, Dart_Null()); | 70 Dart_SetReturnValue(args, Dart_Null()); |
| 70 Dart_Port service_port = IOService::GetServicePort(); | 71 Dart_Port service_port = IOService::GetServicePort(); |
| 71 if (service_port != ILLEGAL_PORT) { | 72 if (service_port != ILLEGAL_PORT) { |
| 72 // Return a send port for the service port. | 73 // Return a send port for the service port. |
| 73 Dart_Handle send_port = Dart_NewSendPort(service_port); | 74 Dart_Handle send_port = Dart_NewSendPort(service_port); |
| 74 Dart_SetReturnValue(args, send_port); | 75 Dart_SetReturnValue(args, send_port); |
| 75 } | 76 } |
| 76 } | 77 } |
| 77 | 78 |
| 78 | 79 |
| 79 } // namespace bin | 80 } // namespace bin |
| 80 } // namespace dart | 81 } // namespace dart |
| OLD | NEW |