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

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: Created 7 years, 9 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
Index: sdk/lib/io/http_impl.dart
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index 1de89c4c762b9e7fb367ceedd342bfbc60b1defc..8a77247eeb11121de178b51dbed4ca1e9278eede 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') | sdk/lib/io/io_sink.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698