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

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

Issue 2220883004: Use metadata annotation @patch for patch classes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: wip Created 4 years, 4 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
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}) {
11 return _RawServerSocket.bind(address, port, backlog, v6Only, shared); 11 return _RawServerSocket.bind(address, port, backlog, v6Only, shared);
12 } 12 }
13 } 13 }
14 14
15 15
16 patch class RawSocket { 16 @patch class RawSocket {
17 /* patch */ static Future<RawSocket> connect( 17 /* @patch */ static Future<RawSocket> connect(
18 host, int port, {sourceAddress}) { 18 host, int port, {sourceAddress}) {
19 return _RawSocket.connect(host, port, sourceAddress); 19 return _RawSocket.connect(host, port, sourceAddress);
20 } 20 }
21 } 21 }
22 22
23 23
24 patch class InternetAddress { 24 @patch class InternetAddress {
25 /* patch */ static InternetAddress get LOOPBACK_IP_V4 { 25 /* @patch */ static InternetAddress get LOOPBACK_IP_V4 {
26 return _InternetAddress.LOOPBACK_IP_V4; 26 return _InternetAddress.LOOPBACK_IP_V4;
27 } 27 }
28 28
29 /* patch */ static InternetAddress get LOOPBACK_IP_V6 { 29 /* @patch */ static InternetAddress get LOOPBACK_IP_V6 {
30 return _InternetAddress.LOOPBACK_IP_V6; 30 return _InternetAddress.LOOPBACK_IP_V6;
31 } 31 }
32 32
33 /* patch */ static InternetAddress get ANY_IP_V4 { 33 /* @patch */ static InternetAddress get ANY_IP_V4 {
34 return _InternetAddress.ANY_IP_V4; 34 return _InternetAddress.ANY_IP_V4;
35 } 35 }
36 36
37 /* patch */ static InternetAddress get ANY_IP_V6 { 37 /* @patch */ static InternetAddress get ANY_IP_V6 {
38 return _InternetAddress.ANY_IP_V6; 38 return _InternetAddress.ANY_IP_V6;
39 } 39 }
40 40
41 /* patch */ factory InternetAddress(String address) { 41 /* @patch */ factory InternetAddress(String address) {
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 /* patch */ static InternetAddress _cloneWithNewHost( 50 /* @patch */ static InternetAddress _cloneWithNewHost(
51 InternetAddress address, String host) { 51 InternetAddress address, String host) {
52 return (address as _InternetAddress)._cloneWithNewHost(host); 52 return (address as _InternetAddress)._cloneWithNewHost(host);
53 } 53 }
54 } 54 }
55 55
56 patch class NetworkInterface { 56 @patch class NetworkInterface {
57 /* patch */ static bool get listSupported { 57 /* @patch */ static bool get listSupported {
58 return _listSupported(); 58 return _listSupported();
59 } 59 }
60 60
61 /* patch */ static Future<List<NetworkInterface>> list({ 61 /* @patch */ static Future<List<NetworkInterface>> list({
62 bool includeLoopback: false, 62 bool includeLoopback: false,
63 bool includeLinkLocal: false, 63 bool includeLinkLocal: false,
64 InternetAddressType type: InternetAddressType.ANY}) { 64 InternetAddressType type: InternetAddressType.ANY}) {
65 return _NativeSocket.listInterfaces(includeLoopback: includeLoopback, 65 return _NativeSocket.listInterfaces(includeLoopback: includeLoopback,
66 includeLinkLocal: includeLinkLocal, 66 includeLinkLocal: includeLinkLocal,
67 type: type); 67 type: type);
68 } 68 }
69 69
70 static bool _listSupported() native "NetworkInterface_ListSupported"; 70 static bool _listSupported() native "NetworkInterface_ListSupported";
71 } 71 }
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 _resume(); 1353 _resume();
1354 } else { 1354 } else {
1355 _socket.close(); 1355 _socket.close();
1356 } 1356 }
1357 } 1357 }
1358 1358
1359 void set _owner(owner) { _socket.owner = owner; } 1359 void set _owner(owner) { _socket.owner = owner; }
1360 } 1360 }
1361 1361
1362 1362
1363 patch class ServerSocket { 1363 @patch class ServerSocket {
1364 /* patch */ static Future<ServerSocket> bind(address, 1364 /* @patch */ static Future<ServerSocket> bind(address,
1365 int port, 1365 int port,
1366 {int backlog: 0, 1366 {int backlog: 0,
1367 bool v6Only: false, 1367 bool v6Only: false,
1368 bool shared: false}) { 1368 bool shared: false}) {
1369 return _ServerSocket.bind(address, port, backlog, v6Only, shared); 1369 return _ServerSocket.bind(address, port, backlog, v6Only, shared);
1370 } 1370 }
1371 } 1371 }
1372 1372
1373 1373
1374 class _ServerSocket extends Stream<Socket> 1374 class _ServerSocket extends Stream<Socket>
(...skipping 25 matching lines...) Expand all
1400 int get port => _socket.port; 1400 int get port => _socket.port;
1401 1401
1402 InternetAddress get address => _socket.address; 1402 InternetAddress get address => _socket.address;
1403 1403
1404 Future close() => _socket.close().then((_) => this); 1404 Future close() => _socket.close().then((_) => this);
1405 1405
1406 void set _owner(owner) { _socket._owner = owner; } 1406 void set _owner(owner) { _socket._owner = owner; }
1407 } 1407 }
1408 1408
1409 1409
1410 patch class Socket { 1410 @patch class Socket {
1411 /* patch */ static Future<Socket> connect(host, int port, {sourceAddress}) { 1411 /* @patch */ static Future<Socket> connect(host, int port, {sourceAddress}) {
1412 return RawSocket.connect(host, port, sourceAddress: sourceAddress).then( 1412 return RawSocket.connect(host, port, sourceAddress: sourceAddress).then(
1413 (socket) => new _Socket(socket)); 1413 (socket) => new _Socket(socket));
1414 } 1414 }
1415 } 1415 }
1416 1416
1417 1417
1418 class _SocketStreamConsumer extends StreamConsumer<List<int>> { 1418 class _SocketStreamConsumer extends StreamConsumer<List<int>> {
1419 StreamSubscription subscription; 1419 StreamSubscription subscription;
1420 final _Socket socket; 1420 final _Socket socket;
1421 int offset; 1421 int offset;
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 _raw.shutdown(SocketDirection.SEND); 1713 _raw.shutdown(SocketDirection.SEND);
1714 _disableWriteEvent(); 1714 _disableWriteEvent();
1715 } 1715 }
1716 } 1716 }
1717 } 1717 }
1718 1718
1719 void set _owner(owner) { _raw._owner = owner; } 1719 void set _owner(owner) { _raw._owner = owner; }
1720 } 1720 }
1721 1721
1722 1722
1723 patch class RawDatagramSocket { 1723 @patch class RawDatagramSocket {
1724 /* patch */ static Future<RawDatagramSocket> bind( 1724 /* @patch */ static Future<RawDatagramSocket> bind(
1725 host, int port, {bool reuseAddress: true}) { 1725 host, int port, {bool reuseAddress: true}) {
1726 return _RawDatagramSocket.bind(host, port, reuseAddress); 1726 return _RawDatagramSocket.bind(host, port, reuseAddress);
1727 } 1727 }
1728 } 1728 }
1729 1729
1730 class _RawDatagramSocket extends Stream implements RawDatagramSocket { 1730 class _RawDatagramSocket extends Stream implements RawDatagramSocket {
1731 _NativeSocket _socket; 1731 _NativeSocket _socket;
1732 StreamController<RawSocketEvent> _controller; 1732 StreamController<RawSocketEvent> _controller;
1733 bool _readEventsEnabled = true; 1733 bool _readEventsEnabled = true;
1734 bool _writeEventsEnabled = true; 1734 bool _writeEventsEnabled = true;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1864 Datagram _makeDatagram(List<int> data, 1864 Datagram _makeDatagram(List<int> data,
1865 String address, 1865 String address,
1866 List<int> in_addr, 1866 List<int> in_addr,
1867 int port) { 1867 int port) {
1868 return new Datagram( 1868 return new Datagram(
1869 data, 1869 data,
1870 new _InternetAddress(address, null, in_addr), 1870 new _InternetAddress(address, null, in_addr),
1871 port); 1871 port);
1872 } 1872 }
1873 1873
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698