| 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" |
| 11 | 11 |
| 12 #include "platform/globals.h" | 12 #include "platform/globals.h" |
| 13 #include "platform/thread.h" | 13 #include "platform/thread.h" |
| 14 #include "platform/utils.h" | 14 #include "platform/utils.h" |
| 15 | 15 |
| 16 #include "include/dart_api.h" | 16 #include "include/dart_api.h" |
| 17 | 17 |
| 18 namespace dart { | 18 namespace dart { |
| 19 namespace bin { | 19 namespace bin { |
| 20 | 20 |
| 21 static const int kSocketIdNativeField = 0; | 21 static const int kSocketIdNativeField = 0; |
| 22 | 22 |
| 23 dart::Mutex* Socket::mutex_ = new dart::Mutex(); | |
| 24 int Socket::service_ports_size_ = 0; | |
| 25 Dart_Port* Socket::service_ports_ = NULL; | |
| 26 int Socket::service_ports_index_ = 0; | |
| 27 | |
| 28 | |
| 29 void FUNCTION_NAME(InternetAddress_Parse)(Dart_NativeArguments args) { | 23 void FUNCTION_NAME(InternetAddress_Parse)(Dart_NativeArguments args) { |
| 30 const char* address = | 24 const char* address = |
| 31 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); | 25 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); |
| 32 ASSERT(address != NULL); | 26 ASSERT(address != NULL); |
| 33 RawAddr raw; | 27 RawAddr raw; |
| 34 memset(&raw, 0, sizeof(raw)); | 28 memset(&raw, 0, sizeof(raw)); |
| 35 int type = strchr(address, ':') == NULL ? SocketAddress::TYPE_IPV4 | 29 int type = strchr(address, ':') == NULL ? SocketAddress::TYPE_IPV4 |
| 36 : SocketAddress::TYPE_IPV6; | 30 : SocketAddress::TYPE_IPV6; |
| 37 if (type == SocketAddress::TYPE_IPV4) { | 31 if (type == SocketAddress::TYPE_IPV4) { |
| 38 raw.addr.sa_family = AF_INET; | 32 raw.addr.sa_family = AF_INET; |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 intptr_t Socket::GetSocketIdNativeField(Dart_Handle socket_obj) { | 680 intptr_t Socket::GetSocketIdNativeField(Dart_Handle socket_obj) { |
| 687 intptr_t socket = 0; | 681 intptr_t socket = 0; |
| 688 Dart_Handle err = | 682 Dart_Handle err = |
| 689 Dart_GetNativeInstanceField(socket_obj, kSocketIdNativeField, &socket); | 683 Dart_GetNativeInstanceField(socket_obj, kSocketIdNativeField, &socket); |
| 690 if (Dart_IsError(err)) Dart_PropagateError(err); | 684 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 691 return socket; | 685 return socket; |
| 692 } | 686 } |
| 693 | 687 |
| 694 } // namespace bin | 688 } // namespace bin |
| 695 } // namespace dart | 689 } // namespace dart |
| OLD | NEW |