Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 { | 6 class _SocketBase { |
| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 } | 289 } |
| 290 if (offset < 0) { | 290 if (offset < 0) { |
| 291 throw new IndexOutOfRangeException(offset); | 291 throw new IndexOutOfRangeException(offset); |
| 292 } | 292 } |
| 293 if (bytes < 0) { | 293 if (bytes < 0) { |
| 294 throw new IndexOutOfRangeException(bytes); | 294 throw new IndexOutOfRangeException(bytes); |
| 295 } | 295 } |
| 296 if ((offset + bytes) > buffer.length) { | 296 if ((offset + bytes) > buffer.length) { |
| 297 throw new IndexOutOfRangeException(offset + bytes); | 297 throw new IndexOutOfRangeException(offset + bytes); |
| 298 } | 298 } |
| 299 return _readList(buffer, offset, bytes); | 299 int result = _readList(buffer, offset, bytes); |
| 300 if (result < 0) { | |
| 301 throw new SocketIOException("Error: readList failed"); | |
|
turnidge
2011/11/16 18:50:18
Yeah, here would be a good place to have that erro
| |
| 302 } | |
| 303 return result; | |
| 300 } | 304 } |
| 301 throw new | 305 throw new |
| 302 SocketIOException("Error: readList failed - invalid socket handle"); | 306 SocketIOException("Error: readList failed - invalid socket handle"); |
| 303 } | 307 } |
| 304 | 308 |
| 305 int _readList(List<int> buffer, int offset, int bytes) | 309 int _readList(List<int> buffer, int offset, int bytes) |
| 306 native "Socket_ReadList"; | 310 native "Socket_ReadList"; |
| 307 | 311 |
| 308 int writeList(List<int> buffer, int offset, int bytes) { | 312 int writeList(List<int> buffer, int offset, int bytes) { |
| 309 if (_id >= 0) { | 313 if (_id >= 0) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 363 return _outputStream; | 367 return _outputStream; |
| 364 } | 368 } |
| 365 | 369 |
| 366 bool _closedRead = false; | 370 bool _closedRead = false; |
| 367 bool _closedWrite = false; | 371 bool _closedWrite = false; |
| 368 bool _pipe = false; | 372 bool _pipe = false; |
| 369 SocketInputStream _inputStream; | 373 SocketInputStream _inputStream; |
| 370 SocketOutputStream _outputStream; | 374 SocketOutputStream _outputStream; |
| 371 } | 375 } |
| 372 | 376 |
| OLD | NEW |