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

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

Issue 10832188: Add an OutputStream.closed getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/output_stream.dart ('k') | tests/standalone/io/file_output_stream_test.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 SocketInputStream { 5 class _SocketInputStream implements SocketInputStream {
6 _SocketInputStream(Socket socket) : _socket = socket { 6 _SocketInputStream(Socket socket) : _socket = socket {
7 if (_socket._id == -1) _closed = true; 7 if (_socket._id == -1) _closed = true;
8 _socket.onClosed = _onClosed; 8 _socket.onClosed = _onClosed;
9 } 9 }
10 10
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 } 130 }
131 131
132 void destroy() { 132 void destroy() {
133 _socket.onWrite = null; 133 _socket.onWrite = null;
134 _pendingWrites.clear(); 134 _pendingWrites.clear();
135 _socket.close(); 135 _socket.close();
136 _closed = true; 136 _closed = true;
137 } 137 }
138 138
139 bool get closed() => _closed;
140
139 void set onNoPendingWrites(void callback()) { 141 void set onNoPendingWrites(void callback()) {
140 _onNoPendingWrites = callback; 142 _onNoPendingWrites = callback;
141 if (_onNoPendingWrites != null) { 143 if (_onNoPendingWrites != null) {
142 _socket._onWrite = _onWrite; 144 _socket._onWrite = _onWrite;
143 } 145 }
144 } 146 }
145 147
146 void set onClosed(void callback()) { 148 void set onClosed(void callback()) {
147 _onClosed = callback; 149 _onClosed = callback;
148 } 150 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 } 214 }
213 } 215 }
214 216
215 Socket _socket; 217 Socket _socket;
216 _BufferList _pendingWrites; 218 _BufferList _pendingWrites;
217 Function _onNoPendingWrites; 219 Function _onNoPendingWrites;
218 Function _onClosed; 220 Function _onClosed;
219 bool _closing = false; 221 bool _closing = false;
220 bool _closed = false; 222 bool _closed = false;
221 } 223 }
OLDNEW
« no previous file with comments | « runtime/bin/output_stream.dart ('k') | tests/standalone/io/file_output_stream_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698