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

Unified Diff: sdk/lib/async/stream.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 | « runtime/bin/socket_patch.dart ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/stream.dart
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart
index 38ace6dab4daa9a182908c72b7d38e446710cefc..e7a5ab685f075cdab3a2db36bd9dd23962dac3fb 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -237,6 +237,8 @@ abstract class Stream<T> {
* Binds this stream as the input of the provided [StreamConsumer].
*/
Future pipe(StreamConsumer<T, dynamic> streamConsumer) {
+ // TODO(floitsch): switch to:
+ // streamConsumer.addStream(this).then((_) => streamConsumer.close());
return streamConsumer.consume(this);
}
@@ -983,6 +985,16 @@ class EventSinkView<T> extends StreamSink<T> {
* done.
*/
abstract class StreamConsumer<S, T> {
+ // TODO(floitsch): generic types.
+ // Currently not possible to add generic types, since they clash with other
+ // types that have already been used.
+ Future addStream(Stream<S> stream);
+ Future close();
+
+
+ /**
+ * Consume is deprecated. Use [addStream] followed by [close] instead.
+ */
Future<T> consume(Stream<S> stream);
}
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698