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

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

Issue 13680002: StreamConsumer has an addStream and a close functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update comments. 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/http_parser.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 ea4e1d7ee41a48222a31e7b0aa14e6bb4563cd28..6fc339a8616b7c18e608e1ddf9a2977c73918f88 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -407,12 +407,16 @@ abstract class _HttpOutboundMessage<T> implements IOSink {
return _ioSink.consume(stream);
}
- Future<T> writeStream(Stream<List<int>> stream) {
+ Future<T> addStream(Stream<List<int>> stream) {
_writeHeaders();
return _ioSink.writeStream(stream).then((_) => this);
}
- void close() {
+ Future<T> writeStream(Stream<List<int>> stream) {
+ return addStream(stream);
+ }
+
+ Future close() {
// TODO(ajohnsen): Currently, contentLength, chunkedTransferEncoding and
// persistentConnection is not guaranteed to be in sync.
if (!_headersWritten && !_ignoreBody && headers.contentLength == -1) {
@@ -422,7 +426,7 @@ abstract class _HttpOutboundMessage<T> implements IOSink {
headers.contentLength = 0;
}
_writeHeaders();
- _ioSink.close();
+ return _ioSink.close();
}
Future<T> get done {
@@ -487,6 +491,14 @@ class _HttpOutboundConsumer implements StreamConsumer {
bool this._asGZip);
Future consume(var stream) => _consume(_ioSink, stream, _asGZip);
+
+ Future addStream(var stream) {
+ throw new UnimplementedError("_HttpOutboundConsumer.addStream");
+ }
+
+ Future close() {
+ throw new UnimplementedError("_HttpOutboundConsumer.close");
+ }
}
@@ -894,6 +906,14 @@ class _HttpOutgoing implements StreamConsumer<List<int>, dynamic> {
// Use .then to ensure a Future branch.
return _consumeCompleter.future.then((_) => this);
}
+
+ Future addStream(Stream<List<int>> stream) {
+ throw new UnimplementedError("_HttpOutgoing.addStream");
+ }
+
+ Future close() {
+ throw new UnimplementedError("_HttpOutgoing.close");
+ }
}
@@ -1653,13 +1673,17 @@ class _DetachedSocket extends Stream<List<int>> implements Socket {
return _socket.consume(stream);
}
+ Future<Socket> addStream(Stream<List<int>> stream) {
+ return _socket.addStream(stream);
+ }
+
Future<Socket> writeStream(Stream<List<int>> stream) {
return _socket.writeStream(stream);
}
void destroy() => _socket.destroy();
- void close() => _socket.close();
+ Future close() => _socket.close();
Future<Socket> get done => _socket.done;
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | sdk/lib/io/http_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698