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

Unified Diff: sdk/lib/io/http_impl.dart

Issue 14150002: Remove StreamSink(replaced by EventSink) and make IOSink extend EventSink. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | sdk/lib/io/io_sink.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http_impl.dart
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index ec6fe8f0a7acd4826e6c1e8333bb196579ed6669..2ddb86225abe0bc043135cbe76f4c9c7dd27d44e 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -400,10 +400,15 @@ abstract class _HttpOutboundMessage<T> implements IOSink {
write(new String.fromCharCode(charCode));
}
- void writeBytes(List<int> data) {
+ void add(List<int> data) {
_writeHeaders();
if (data.length == 0) return;
- _ioSink.writeBytes(data);
+ _ioSink.add(data);
+ }
+
+ void addError(AsyncError error) {
+ _writeHeaders();
+ _ioSink.addError(error);
}
Future<T> consume(Stream<List<int>> stream) {
@@ -627,7 +632,7 @@ class _HttpResponse extends _HttpOutboundMessage<HttpResponse>
// Write headers.
headers._write(buffer);
writeCRLF();
- _ioSink.writeBytes(buffer.readBytes());
+ _ioSink.add(buffer.readBytes());
}
String _findReasonPhrase(int statusCode) {
@@ -832,7 +837,7 @@ class _HttpClientRequest extends _HttpOutboundMessage<HttpClientResponse>
// Write headers.
headers._write(buffer);
writeCRLF();
- _ioSink.writeBytes(buffer.readBytes());
+ _ioSink.add(buffer.readBytes());
}
}
@@ -1681,7 +1686,9 @@ class _DetachedSocket extends Stream<List<int>> implements Socket {
_socket.writeAll(objects, separator);
}
- void writeBytes(List<int> bytes) => _socket.writeBytes(bytes);
+ void add(List<int> bytes) => _socket.add(bytes);
+
+ void addError(AsyncError error) => _socket.addError(error);
Future<Socket> consume(Stream<List<int>> stream) {
return _socket.consume(stream);
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | sdk/lib/io/io_sink.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698