| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 | 5 |
| 6 class _SocketBase extends NativeFieldWrapperClass1 { | 6 class _SocketBase extends NativeFieldWrapperClass1 { |
| 7 // Bit flags used when communicating between the eventhandler and | 7 // Bit flags used when communicating between the eventhandler and |
| 8 // dart code. The EVENT flags are used to indicate events of | 8 // dart code. The EVENT flags are used to indicate events of |
| 9 // interest when sending a message from dart code to the | 9 // interest when sending a message from dart code to the |
| 10 // eventhandler. When receiving a message from the eventhandler the | 10 // eventhandler. When receiving a message from the eventhandler the |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 } | 384 } |
| 385 return result; | 385 return result; |
| 386 } | 386 } |
| 387 throw new | 387 throw new |
| 388 SocketIOException("Error: readList failed - invalid socket handle"); | 388 SocketIOException("Error: readList failed - invalid socket handle"); |
| 389 } | 389 } |
| 390 | 390 |
| 391 _readList(List<int> buffer, int offset, int bytes) native "Socket_ReadList"; | 391 _readList(List<int> buffer, int offset, int bytes) native "Socket_ReadList"; |
| 392 | 392 |
| 393 int writeList(List<int> buffer, int offset, int bytes) { | 393 int writeList(List<int> buffer, int offset, int bytes) { |
| 394 if (buffer is! List || offset is! int || bytes is! int) { |
| 395 throw new ArgumentError( |
| 396 "Invalid arguments to writeList on Socket"); |
| 397 } |
| 394 if (!_closed) { | 398 if (!_closed) { |
| 395 if (bytes == 0) { | 399 if (bytes == 0) { |
| 396 return 0; | 400 return 0; |
| 397 } | 401 } |
| 398 if (offset < 0) { | 402 if (offset < 0) { |
| 399 throw new IndexOutOfRangeException(offset); | 403 throw new IndexOutOfRangeException(offset); |
| 400 } | 404 } |
| 401 if (bytes < 0) { | 405 if (bytes < 0) { |
| 402 throw new IndexOutOfRangeException(bytes); | 406 throw new IndexOutOfRangeException(bytes); |
| 403 } | 407 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 bool _seenFirstOutEvent = false; | 571 bool _seenFirstOutEvent = false; |
| 568 bool _pipe = false; | 572 bool _pipe = false; |
| 569 Function _clientConnectHandler; | 573 Function _clientConnectHandler; |
| 570 Function _clientWriteHandler; | 574 Function _clientWriteHandler; |
| 571 SocketInputStream _inputStream; | 575 SocketInputStream _inputStream; |
| 572 SocketOutputStream _outputStream; | 576 SocketOutputStream _outputStream; |
| 573 String _remoteHost; | 577 String _remoteHost; |
| 574 int _remotePort; | 578 int _remotePort; |
| 575 static SendPort _socketService; | 579 static SendPort _socketService; |
| 576 } | 580 } |
| OLD | NEW |