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/io_buffer.h" | 5 #include "bin/io_buffer.h" |
6 #include "bin/socket.h" | 6 #include "bin/socket.h" |
7 #include "bin/dartutils.h" | 7 #include "bin/dartutils.h" |
8 #include "bin/thread.h" | 8 #include "bin/thread.h" |
9 #include "bin/utils.h" | 9 #include "bin/utils.h" |
10 | 10 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 intptr_t num = | 278 intptr_t num = |
279 DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); | 279 DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); |
280 ASSERT(num == 0 || num == 1 || num == 2); | 280 ASSERT(num == 0 || num == 1 || num == 2); |
281 intptr_t socket = Socket::GetStdioHandle(num); | 281 intptr_t socket = Socket::GetStdioHandle(num); |
282 Dart_Handle err = Socket::SetSocketIdNativeField(socket_obj, socket); | 282 Dart_Handle err = Socket::SetSocketIdNativeField(socket_obj, socket); |
283 if (Dart_IsError(err)) Dart_PropagateError(err); | 283 if (Dart_IsError(err)) Dart_PropagateError(err); |
284 Dart_SetReturnValue(args, Dart_NewBoolean(socket >= 0)); | 284 Dart_SetReturnValue(args, Dart_NewBoolean(socket >= 0)); |
285 } | 285 } |
286 | 286 |
287 | 287 |
| 288 void FUNCTION_NAME(Socket_SetSocketId)(Dart_NativeArguments args) { |
| 289 Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0); |
| 290 intptr_t id = |
| 291 DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); |
| 292 Dart_Handle err = Socket::SetSocketIdNativeField(socket_obj, id); |
| 293 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 294 } |
| 295 |
| 296 |
288 void FUNCTION_NAME(ServerSocket_CreateBindListen)(Dart_NativeArguments args) { | 297 void FUNCTION_NAME(ServerSocket_CreateBindListen)(Dart_NativeArguments args) { |
289 Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0); | 298 Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0); |
290 Dart_Handle host_obj = Dart_GetNativeArgument(args, 1); | 299 Dart_Handle host_obj = Dart_GetNativeArgument(args, 1); |
291 RawAddr addr; | 300 RawAddr addr; |
292 Dart_Handle result = GetSockAddr(host_obj, &addr); | 301 Dart_Handle result = GetSockAddr(host_obj, &addr); |
293 Dart_Handle port_obj = Dart_GetNativeArgument(args, 2); | 302 Dart_Handle port_obj = Dart_GetNativeArgument(args, 2); |
294 Dart_Handle backlog_obj = Dart_GetNativeArgument(args, 3); | 303 Dart_Handle backlog_obj = Dart_GetNativeArgument(args, 3); |
295 Dart_Handle v6_only_obj = Dart_GetNativeArgument(args, 4); | 304 Dart_Handle v6_only_obj = Dart_GetNativeArgument(args, 4); |
296 bool v6_only = DartUtils::GetBooleanValue(v6_only_obj); | 305 bool v6_only = DartUtils::GetBooleanValue(v6_only_obj); |
297 int64_t port = 0; | 306 int64_t port = 0; |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 return Dart_SetNativeInstanceField(socket, kSocketIdNativeField, id); | 569 return Dart_SetNativeInstanceField(socket, kSocketIdNativeField, id); |
561 } | 570 } |
562 | 571 |
563 | 572 |
564 Dart_Handle Socket::GetSocketIdNativeField(Dart_Handle socket, intptr_t* id) { | 573 Dart_Handle Socket::GetSocketIdNativeField(Dart_Handle socket, intptr_t* id) { |
565 return Dart_GetNativeInstanceField(socket, kSocketIdNativeField, id); | 574 return Dart_GetNativeInstanceField(socket, kSocketIdNativeField, id); |
566 } | 575 } |
567 | 576 |
568 } // namespace bin | 577 } // namespace bin |
569 } // namespace dart | 578 } // namespace dart |
OLD | NEW |