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

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

Issue 9969202: Add method flush to output stream (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 bool write(List<int> buffer, [bool copyBuffer = true]) { 97 bool write(List<int> buffer, [bool copyBuffer = true]) {
98 return _write(buffer, 0, buffer.length, copyBuffer); 98 return _write(buffer, 0, buffer.length, copyBuffer);
99 } 99 }
100 100
101 bool writeFrom(List<int> buffer, [int offset = 0, int len]) { 101 bool writeFrom(List<int> buffer, [int offset = 0, int len]) {
102 return _write( 102 return _write(
103 buffer, offset, (len == null) ? buffer.length - offset : len, true); 103 buffer, offset, (len == null) ? buffer.length - offset : len, true);
104 } 104 }
105 105
106 void flush() {
107 // Nothing to do on a socket output stream.
108 }
109
106 void close() { 110 void close() {
107 if (!_pendingWrites.isEmpty()) { 111 if (!_pendingWrites.isEmpty()) {
108 // Mark the socket for close when all data is written. 112 // Mark the socket for close when all data is written.
109 _closing = true; 113 _closing = true;
110 _socket._onWrite = _onWrite; 114 _socket._onWrite = _onWrite;
111 } else { 115 } else {
112 // Close the socket for writing. 116 // Close the socket for writing.
113 _socket._closeWrite(); 117 _socket._closeWrite();
114 _closed = true; 118 _closed = true;
115 } 119 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 if (_errorCallback != null) _errorCallback(e); 194 if (_errorCallback != null) _errorCallback(e);
191 } 195 }
192 196
193 Socket _socket; 197 Socket _socket;
194 _BufferList _pendingWrites; 198 _BufferList _pendingWrites;
195 var _onNoPendingWrites; 199 var _onNoPendingWrites;
196 Function _errorCallback; 200 Function _errorCallback;
197 bool _closing = false; 201 bool _closing = false;
198 bool _closed = false; 202 bool _closed = false;
199 } 203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698