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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 raw.in6.sin6_family = AF_INET6; | 68 raw.in6.sin6_family = AF_INET6; |
69 raw.in6.sin6_addr = in6addr_loopback; | 69 raw.in6.sin6_addr = in6addr_loopback; |
70 break; | 70 break; |
71 } | 71 } |
72 default: | 72 default: |
73 Dart_Handle error = DartUtils::NewDartArgumentError(""); | 73 Dart_Handle error = DartUtils::NewDartArgumentError(""); |
74 if (Dart_IsError(error)) Dart_PropagateError(error); | 74 if (Dart_IsError(error)) Dart_PropagateError(error); |
75 Dart_ThrowException(error); | 75 Dart_ThrowException(error); |
76 } | 76 } |
77 int len = SocketAddress::GetAddrLength(raw); | 77 int len = SocketAddress::GetAddrLength(raw); |
78 Dart_Handle result = Dart_NewTypedData(kUint8, len); | 78 Dart_Handle result = Dart_NewTypedData(Dart_TypedData_kUint8, len); |
79 if (Dart_IsError(result)) Dart_PropagateError(result); | 79 if (Dart_IsError(result)) Dart_PropagateError(result); |
80 Dart_ListSetAsBytes(result, 0, reinterpret_cast<uint8_t *>(&raw), len); | 80 Dart_ListSetAsBytes(result, 0, reinterpret_cast<uint8_t *>(&raw), len); |
81 Dart_SetReturnValue(args, result); | 81 Dart_SetReturnValue(args, result); |
82 Dart_ExitScope(); | 82 Dart_ExitScope(); |
83 } | 83 } |
84 | 84 |
85 | 85 |
86 void FUNCTION_NAME(Socket_CreateConnect)(Dart_NativeArguments args) { | 86 void FUNCTION_NAME(Socket_CreateConnect)(Dart_NativeArguments args) { |
87 Dart_EnterScope(); | 87 Dart_EnterScope(); |
88 Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0); | 88 Dart_Handle socket_obj = Dart_GetNativeArgument(args, 0); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 } | 484 } |
485 return CObject::IllegalArgumentError(); | 485 return CObject::IllegalArgumentError(); |
486 } | 486 } |
487 | 487 |
488 | 488 |
489 void SocketService(Dart_Port dest_port_id, | 489 void SocketService(Dart_Port dest_port_id, |
490 Dart_Port reply_port_id, | 490 Dart_Port reply_port_id, |
491 Dart_CObject* message) { | 491 Dart_CObject* message) { |
492 CObject* response = CObject::IllegalArgumentError(); | 492 CObject* response = CObject::IllegalArgumentError(); |
493 CObjectArray request(message); | 493 CObjectArray request(message); |
494 if (message->type == Dart_CObject::kArray) { | 494 if (message->type == Dart_CObject_kArray) { |
495 if (request.Length() > 1 && request[0]->IsInt32()) { | 495 if (request.Length() > 1 && request[0]->IsInt32()) { |
496 CObjectInt32 request_type(request[0]); | 496 CObjectInt32 request_type(request[0]); |
497 switch (request_type.Value()) { | 497 switch (request_type.Value()) { |
498 case Socket::kLookupRequest: | 498 case Socket::kLookupRequest: |
499 response = LookupRequest(request); | 499 response = LookupRequest(request); |
500 break; | 500 break; |
501 default: | 501 default: |
502 UNREACHABLE(); | 502 UNREACHABLE(); |
503 } | 503 } |
504 } | 504 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 return Dart_SetNativeInstanceField(socket, kSocketIdNativeField, id); | 577 return Dart_SetNativeInstanceField(socket, kSocketIdNativeField, id); |
578 } | 578 } |
579 | 579 |
580 | 580 |
581 Dart_Handle Socket::GetSocketIdNativeField(Dart_Handle socket, intptr_t* id) { | 581 Dart_Handle Socket::GetSocketIdNativeField(Dart_Handle socket, intptr_t* id) { |
582 return Dart_GetNativeInstanceField(socket, kSocketIdNativeField, id); | 582 return Dart_GetNativeInstanceField(socket, kSocketIdNativeField, id); |
583 } | 583 } |
584 | 584 |
585 } // namespace bin | 585 } // namespace bin |
586 } // namespace dart | 586 } // namespace dart |
OLD | NEW |