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

Side by Side Diff: runtime/bin/socket_patch.dart

Issue 1916223003: Fixes NetworkInterface.list crash on Android (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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_macos.cc ('k') | runtime/bin/socket_unsupported.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 patch class RawServerSocket { 5 patch class RawServerSocket {
6 /* patch */ static Future<RawServerSocket> bind(address, 6 /* patch */ static Future<RawServerSocket> bind(address,
7 int port, 7 int port,
8 {int backlog: 0, 8 {int backlog: 0,
9 bool v6Only: false, 9 bool v6Only: false,
10 bool shared: false}) { 10 bool shared: false}) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return new _InternetAddress.parse(address); 42 return new _InternetAddress.parse(address);
43 } 43 }
44 44
45 /* patch */ static Future<List<InternetAddress>> lookup( 45 /* patch */ static Future<List<InternetAddress>> lookup(
46 String host, {InternetAddressType type: InternetAddressType.ANY}) { 46 String host, {InternetAddressType type: InternetAddressType.ANY}) {
47 return _NativeSocket.lookup(host, type: type); 47 return _NativeSocket.lookup(host, type: type);
48 } 48 }
49 } 49 }
50 50
51 patch class NetworkInterface { 51 patch class NetworkInterface {
52 /* patch */ static bool get listSupported {
53 return _listSupported();
54 }
55
52 /* patch */ static Future<List<NetworkInterface>> list({ 56 /* patch */ static Future<List<NetworkInterface>> list({
53 bool includeLoopback: false, 57 bool includeLoopback: false,
54 bool includeLinkLocal: false, 58 bool includeLinkLocal: false,
55 InternetAddressType type: InternetAddressType.ANY}) { 59 InternetAddressType type: InternetAddressType.ANY}) {
56 return _NativeSocket.listInterfaces(includeLoopback: includeLoopback, 60 return _NativeSocket.listInterfaces(includeLoopback: includeLoopback,
57 includeLinkLocal: includeLinkLocal, 61 includeLinkLocal: includeLinkLocal,
58 type: type); 62 type: type);
59 } 63 }
64
65 static bool _listSupported() native "NetworkInterface_ListSupported";
60 } 66 }
61 67
62 class _InternetAddress implements InternetAddress { 68 class _InternetAddress implements InternetAddress {
63 static const int _ADDRESS_LOOPBACK_IP_V4 = 0; 69 static const int _ADDRESS_LOOPBACK_IP_V4 = 0;
64 static const int _ADDRESS_LOOPBACK_IP_V6 = 1; 70 static const int _ADDRESS_LOOPBACK_IP_V6 = 1;
65 static const int _ADDRESS_ANY_IP_V4 = 2; 71 static const int _ADDRESS_ANY_IP_V4 = 2;
66 static const int _ADDRESS_ANY_IP_V6 = 3; 72 static const int _ADDRESS_ANY_IP_V6 = 3;
67 static const int _IPV4_ADDR_LENGTH = 4; 73 static const int _IPV4_ADDR_LENGTH = 4;
68 static const int _IPV6_ADDR_LENGTH = 16; 74 static const int _IPV6_ADDR_LENGTH = 16;
69 75
(...skipping 1776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 Datagram _makeDatagram(List<int> data, 1852 Datagram _makeDatagram(List<int> data,
1847 String address, 1853 String address,
1848 List<int> in_addr, 1854 List<int> in_addr,
1849 int port) { 1855 int port) {
1850 return new Datagram( 1856 return new Datagram(
1851 data, 1857 data,
1852 new _InternetAddress(address, null, in_addr), 1858 new _InternetAddress(address, null, in_addr),
1853 port); 1859 port);
1854 } 1860 }
1855 1861
OLDNEW
« no previous file with comments | « runtime/bin/socket_macos.cc ('k') | runtime/bin/socket_unsupported.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698