| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/socket.h" | 5 #include "bin/socket.h" |
| 6 #include "bin/dartutils.h" | 6 #include "bin/dartutils.h" |
| 7 #include "bin/thread.h" | 7 #include "bin/thread.h" |
| 8 #include "bin/utils.h" | 8 #include "bin/utils.h" |
| 9 #include "platform/thread.h" | 9 #include "platform/thread.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 intptr_t port = Socket::GetPort(socket); | 146 intptr_t port = Socket::GetPort(socket); |
| 147 if (port > 0) { | 147 if (port > 0) { |
| 148 Dart_SetReturnValue(args, Dart_NewInteger(port)); | 148 Dart_SetReturnValue(args, Dart_NewInteger(port)); |
| 149 } else { | 149 } else { |
| 150 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); | 150 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); |
| 151 } | 151 } |
| 152 Dart_ExitScope(); | 152 Dart_ExitScope(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 | 155 |
| 156 void FUNCTION_NAME(Socket_GetRemotePort)(Dart_NativeArguments args) { |
| 157 Dart_EnterScope(); |
| 158 intptr_t socket = |
| 159 DartUtils::GetIntegerField(Dart_GetNativeArgument(args, 0), |
| 160 DartUtils::kIdFieldName); |
| 161 OSError os_error; |
| 162 intptr_t port = Socket::GetRemotePort(socket); |
| 163 if (port > 0) { |
| 164 Dart_SetReturnValue(args, Dart_NewInteger(port)); |
| 165 } else { |
| 166 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); |
| 167 } |
| 168 Dart_ExitScope(); |
| 169 } |
| 170 |
| 171 |
| 156 void FUNCTION_NAME(Socket_GetError)(Dart_NativeArguments args) { | 172 void FUNCTION_NAME(Socket_GetError)(Dart_NativeArguments args) { |
| 157 Dart_EnterScope(); | 173 Dart_EnterScope(); |
| 158 intptr_t socket = | 174 intptr_t socket = |
| 159 DartUtils::GetIntegerField(Dart_GetNativeArgument(args, 0), | 175 DartUtils::GetIntegerField(Dart_GetNativeArgument(args, 0), |
| 160 DartUtils::kIdFieldName); | 176 DartUtils::kIdFieldName); |
| 161 OSError os_error; | 177 OSError os_error; |
| 162 Socket::GetError(socket, &os_error); | 178 Socket::GetError(socket, &os_error); |
| 163 Dart_SetReturnValue(args, DartUtils::NewDartOSError(&os_error)); | 179 Dart_SetReturnValue(args, DartUtils::NewDartOSError(&os_error)); |
| 164 Dart_ExitScope(); | 180 Dart_ExitScope(); |
| 165 } | 181 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 Dart_EnterScope(); | 307 Dart_EnterScope(); |
| 292 Dart_SetReturnValue(args, Dart_Null()); | 308 Dart_SetReturnValue(args, Dart_Null()); |
| 293 Dart_Port service_port = Socket::GetServicePort(); | 309 Dart_Port service_port = Socket::GetServicePort(); |
| 294 if (service_port != kIllegalPort) { | 310 if (service_port != kIllegalPort) { |
| 295 // Return a send port for the service port. | 311 // Return a send port for the service port. |
| 296 Dart_Handle send_port = Dart_NewSendPort(service_port); | 312 Dart_Handle send_port = Dart_NewSendPort(service_port); |
| 297 Dart_SetReturnValue(args, send_port); | 313 Dart_SetReturnValue(args, send_port); |
| 298 } | 314 } |
| 299 Dart_ExitScope(); | 315 Dart_ExitScope(); |
| 300 } | 316 } |
| OLD | NEW |