Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: runtime/bin/socket_base.cc

Issue 2791163004: Reverting until bots clear up. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/socket_base.h ('k') | runtime/bin/socket_base_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
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.
4
5 #if !defined(DART_IO_DISABLED)
6
7 #include "bin/socket_base.h"
8
9 #include "bin/dartutils.h"
10 #include "bin/io_buffer.h"
11 #include "bin/isolate_data.h"
12 #include "bin/lockers.h"
13 #include "bin/thread.h"
14 #include "bin/utils.h"
15
16 #include "include/dart_api.h"
17
18 #include "platform/globals.h"
19 #include "platform/utils.h"
20
21 namespace dart {
22 namespace bin {
23
24 void FUNCTION_NAME(InternetAddress_Parse)(Dart_NativeArguments args) {
25 const char* address =
26 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
27 ASSERT(address != NULL);
28 RawAddr raw;
29 memset(&raw, 0, sizeof(raw));
30 int type = strchr(address, ':') == NULL ? SocketAddress::TYPE_IPV4
31 : SocketAddress::TYPE_IPV6;
32 if (type == SocketAddress::TYPE_IPV4) {
33 raw.addr.sa_family = AF_INET;
34 } else {
35 raw.addr.sa_family = AF_INET6;
36 }
37 bool ok = SocketBase::ParseAddress(type, address, &raw);
38 if (!ok) {
39 Dart_SetReturnValue(args, Dart_Null());
40 } else {
41 Dart_SetReturnValue(args, SocketAddress::ToTypedData(raw));
42 }
43 }
44
45
46 void FUNCTION_NAME(NetworkInterface_ListSupported)(Dart_NativeArguments args) {
47 Dart_SetReturnValue(args,
48 Dart_NewBoolean(SocketBase::ListInterfacesSupported()));
49 }
50
51
52 void FUNCTION_NAME(SocketBase_IsBindError)(Dart_NativeArguments args) {
53 intptr_t error_number =
54 DartUtils::GetIntptrValue(Dart_GetNativeArgument(args, 1));
55 bool is_bind_error = SocketBase::IsBindError(error_number);
56 Dart_SetReturnValue(args, is_bind_error ? Dart_True() : Dart_False());
57 }
58
59 } // namespace bin
60 } // namespace dart
61
62 #endif // !defined(DART_IO_DISABLED)
OLDNEW
« no previous file with comments | « runtime/bin/socket_base.h ('k') | runtime/bin/socket_base_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698