| 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/dartutils.h" | 7 #include "bin/dartutils.h" |
| 8 #include "bin/socket.h" | 8 #include "bin/socket.h" |
| 9 #include "bin/thread.h" | 9 #include "bin/thread.h" |
| 10 #include "bin/lockers.h" | 10 #include "bin/lockers.h" |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 void FUNCTION_NAME(ServerSocket_Accept)(Dart_NativeArguments args) { | 559 void FUNCTION_NAME(ServerSocket_Accept)(Dart_NativeArguments args) { |
| 560 intptr_t socket = | 560 intptr_t socket = |
| 561 Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); | 561 Socket::GetSocketIdNativeField(Dart_GetNativeArgument(args, 0)); |
| 562 intptr_t new_socket = ServerSocket::Accept(socket); | 562 intptr_t new_socket = ServerSocket::Accept(socket); |
| 563 if (new_socket >= 0) { | 563 if (new_socket >= 0) { |
| 564 Socket::SetSocketIdNativeField(Dart_GetNativeArgument(args, 1), new_socket); | 564 Socket::SetSocketIdNativeField(Dart_GetNativeArgument(args, 1), new_socket); |
| 565 Dart_SetReturnValue(args, Dart_True()); | 565 Dart_SetReturnValue(args, Dart_True()); |
| 566 } else if (new_socket == ServerSocket::kTemporaryFailure) { | 566 } else if (new_socket == ServerSocket::kTemporaryFailure) { |
| 567 Dart_SetReturnValue(args, Dart_False()); | 567 Dart_SetReturnValue(args, Dart_False()); |
| 568 } else { | 568 } else { |
| 569 Dart_SetReturnValue(args, DartUtils::NewDartOSError()); | 569 Dart_Handle err = DartUtils::NewDartOSError(); |
| 570 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 571 Dart_SetReturnValue(args, err); |
| 570 } | 572 } |
| 571 } | 573 } |
| 572 | 574 |
| 573 | 575 |
| 574 CObject* Socket::LookupRequest(const CObjectArray& request) { | 576 CObject* Socket::LookupRequest(const CObjectArray& request) { |
| 575 if (request.Length() == 2 && | 577 if (request.Length() == 2 && |
| 576 request[0]->IsString() && | 578 request[0]->IsString() && |
| 577 request[1]->IsInt32()) { | 579 request[1]->IsInt32()) { |
| 578 CObjectString host(request[0]); | 580 CObjectString host(request[0]); |
| 579 CObjectInt32 type(request[1]); | 581 CObjectInt32 type(request[1]); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 intptr_t Socket::GetSocketIdNativeField(Dart_Handle socket_obj) { | 853 intptr_t Socket::GetSocketIdNativeField(Dart_Handle socket_obj) { |
| 852 intptr_t socket = 0; | 854 intptr_t socket = 0; |
| 853 Dart_Handle err = | 855 Dart_Handle err = |
| 854 Dart_GetNativeInstanceField(socket_obj, kSocketIdNativeField, &socket); | 856 Dart_GetNativeInstanceField(socket_obj, kSocketIdNativeField, &socket); |
| 855 if (Dart_IsError(err)) Dart_PropagateError(err); | 857 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 856 return socket; | 858 return socket; |
| 857 } | 859 } |
| 858 | 860 |
| 859 } // namespace bin | 861 } // namespace bin |
| 860 } // namespace dart | 862 } // namespace dart |
| OLD | NEW |