| 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/isolate_data.h" | 6 #include "bin/isolate_data.h" |
| 7 #include "bin/socket.h" | 7 #include "bin/socket.h" |
| 8 #include "bin/dartutils.h" | 8 #include "bin/dartutils.h" |
| 9 #include "bin/thread.h" | 9 #include "bin/thread.h" |
| 10 #include "bin/utils.h" | 10 #include "bin/utils.h" |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 342 |
| 343 void FUNCTION_NAME(Socket_GetStdioHandle)(Dart_NativeArguments args) { | 343 void FUNCTION_NAME(Socket_GetStdioHandle)(Dart_NativeArguments args) { |
| 344 int64_t num = DartUtils::GetInt64ValueCheckRange( | 344 int64_t num = DartUtils::GetInt64ValueCheckRange( |
| 345 Dart_GetNativeArgument(args, 1), 0, 2); | 345 Dart_GetNativeArgument(args, 1), 0, 2); |
| 346 intptr_t socket = Socket::GetStdioHandle(num); | 346 intptr_t socket = Socket::GetStdioHandle(num); |
| 347 Socket::SetSocketIdNativeField(Dart_GetNativeArgument(args, 0), socket); | 347 Socket::SetSocketIdNativeField(Dart_GetNativeArgument(args, 0), socket); |
| 348 Dart_SetReturnValue(args, Dart_NewBoolean(socket >= 0)); | 348 Dart_SetReturnValue(args, Dart_NewBoolean(socket >= 0)); |
| 349 } | 349 } |
| 350 | 350 |
| 351 | 351 |
| 352 void FUNCTION_NAME(Socket_GetSocketId)(Dart_NativeArguments args) { |
| 353 intptr_t id = |
| 354 Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); |
| 355 Dart_SetReturnValue(args, Dart_NewInteger(id)); |
| 356 } |
| 357 |
| 358 |
| 352 void FUNCTION_NAME(Socket_SetSocketId)(Dart_NativeArguments args) { | 359 void FUNCTION_NAME(Socket_SetSocketId)(Dart_NativeArguments args) { |
| 353 intptr_t id = | 360 intptr_t id = |
| 354 DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); | 361 DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1)); |
| 355 Socket::SetSocketIdNativeField(Dart_GetNativeArgument(args, 0), id); | 362 Socket::SetSocketIdNativeField(Dart_GetNativeArgument(args, 0), id); |
| 356 } | 363 } |
| 357 | 364 |
| 358 | 365 |
| 359 void FUNCTION_NAME(ServerSocket_CreateBindListen)(Dart_NativeArguments args) { | 366 void FUNCTION_NAME(ServerSocket_CreateBindListen)(Dart_NativeArguments args) { |
| 360 RawAddr addr; | 367 RawAddr addr; |
| 361 SocketAddress::GetSockAddr(Dart_GetNativeArgument(args, 1), &addr); | 368 SocketAddress::GetSockAddr(Dart_GetNativeArgument(args, 1), &addr); |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 intptr_t Socket::GetSocketIdNativeField(Dart_Handle socket_obj) { | 687 intptr_t Socket::GetSocketIdNativeField(Dart_Handle socket_obj) { |
| 681 intptr_t socket = 0; | 688 intptr_t socket = 0; |
| 682 Dart_Handle err = | 689 Dart_Handle err = |
| 683 Dart_GetNativeInstanceField(socket_obj, kSocketIdNativeField, &socket); | 690 Dart_GetNativeInstanceField(socket_obj, kSocketIdNativeField, &socket); |
| 684 if (Dart_IsError(err)) Dart_PropagateError(err); | 691 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 685 return socket; | 692 return socket; |
| 686 } | 693 } |
| 687 | 694 |
| 688 } // namespace bin | 695 } // namespace bin |
| 689 } // namespace dart | 696 } // namespace dart |
| OLD | NEW |