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: sdk/lib/io/socket_stream_impl.dart

Issue 11361190: a === b -> identical(a, b) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/list_stream_impl.dart ('k') | sdk/lib/io/stream_util.dart » ('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) 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 class _SocketInputStream implements InputStream { 5 class _SocketInputStream implements InputStream {
6 _SocketInputStream(Socket socket) : _socket = socket { 6 _SocketInputStream(Socket socket) : _socket = socket {
7 if (_socket._closed) _closed = true; 7 if (_socket._closed) _closed = true;
8 _socket.onClosed = _onClosed; 8 _socket.onClosed = _onClosed;
9 } 9 }
10 10
11 List<int> read([int len]) { 11 List<int> read([int len]) {
12 return _socket.read(len); 12 return _socket.read(len);
13 } 13 }
14 14
15 int readInto(List<int> buffer, [int offset = 0, int len]) { 15 int readInto(List<int> buffer, [int offset = 0, int len]) {
16 if (_closed) return null; 16 if (_closed) return null;
17 if (len === null) len = buffer.length; 17 if (len == null) len = buffer.length;
18 if (offset < 0) throw new StreamException("Illegal offset $offset"); 18 if (offset < 0) throw new StreamException("Illegal offset $offset");
19 if (len < 0) throw new StreamException("Illegal length $len"); 19 if (len < 0) throw new StreamException("Illegal length $len");
20 return _socket.readList(buffer, offset, len); 20 return _socket.readList(buffer, offset, len);
21 } 21 }
22 22
23 int available() => _socket.available(); 23 int available() => _socket.available();
24 24
25 void pipe(OutputStream output, {bool close: true}) { 25 void pipe(OutputStream output, {bool close: true}) {
26 _pipe(this, output, close: close); 26 _pipe(this, output, close: close);
27 } 27 }
(...skipping 14 matching lines...) Expand all
42 _clientCloseHandler = callback; 42 _clientCloseHandler = callback;
43 _socket._onClosed = _onClosed; 43 _socket._onClosed = _onClosed;
44 } 44 }
45 45
46 void set onError(void callback(e)) { 46 void set onError(void callback(e)) {
47 _onError = callback; 47 _onError = callback;
48 } 48 }
49 49
50 void _onClosed() { 50 void _onClosed() {
51 _closed = true; 51 _closed = true;
52 if (_clientCloseHandler !== null) { 52 if (_clientCloseHandler != null) {
53 _clientCloseHandler(); 53 _clientCloseHandler();
54 } 54 }
55 } 55 }
56 56
57 bool _onSocketError(e) { 57 bool _onSocketError(e) {
58 close(); 58 close();
59 if (_onError != null) { 59 if (_onError != null) {
60 _onError(e); 60 _onError(e);
61 return true; 61 return true;
62 } else { 62 } else {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } 198 }
199 } 199 }
200 200
201 Socket _socket; 201 Socket _socket;
202 _BufferList _pendingWrites; 202 _BufferList _pendingWrites;
203 Function _onNoPendingWrites; 203 Function _onNoPendingWrites;
204 Function _onClosed; 204 Function _onClosed;
205 bool _closing = false; 205 bool _closing = false;
206 bool _closed = false; 206 bool _closed = false;
207 } 207 }
OLDNEW
« no previous file with comments | « sdk/lib/io/list_stream_impl.dart ('k') | sdk/lib/io/stream_util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698