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

Unified Diff: sdk/lib/async/stream.dart

Issue 301193010: Update documentation for "close". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reword done/close comments. Created 6 years, 7 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/async/broadcast_stream_controller.dart ('k') | sdk/lib/async/stream_controller.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 f953a5a276709316157ec34ddb7f7e7ddcd44fa1..9ddbb0b69fe9c8e3fd76c6d95e3a4135dd7c0c6a 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -1338,11 +1338,11 @@ abstract class StreamSubscription<T> {
* An interface that abstracts creation or handling of [Stream] events.
*/
abstract class EventSink<T> implements Sink<T> {
- /** Create a data event */
+ /** Send a data event to a stream. */
void add(T event);
- /** Create an async error. */
+ /** Send an async error to a stream. */
void addError(errorEvent, [StackTrace stackTrace]);
- /** Request a stream to close. */
+ /** Send a done event to a stream.*/
void close();
}
@@ -1387,6 +1387,12 @@ abstract class StreamConsumer<S> {
*/
Future addStream(Stream<S> stream);
+ /**
+ * Tell the consumer that no futher streams will be added.
+ *
+ * Returns a future that is completed when the consumer is done handling
+ * events.
+ */
Future close();
}
@@ -1410,17 +1416,22 @@ abstract class StreamConsumer<S> {
*/
abstract class StreamSink<S> implements StreamConsumer<S>, EventSink<S> {
/**
- * Close the [StreamSink]. It'll return the [done] Future.
+ * As [EventSink.close], but also returns a future.
Anders Johnsen 2014/06/02 10:58:39 Is 'also' correct?... :)
+ *
+ * Returns the same future as [done].
*/
Future close();
/**
- * The [done] Future completes with the same values as [close], except
- * for the following case:
+ * Return a future which is completed when the [StreamSink] is finished.
+ *
+ * If the `StreamSink` can stop working due to an error,
Anders Johnsen 2014/06/02 10:58:39 If the StreamSink produces an error, perhaps ...
+ * perhaps in response to adding events using [add], [addError] or [close],
+ * the [done] future will complete with that error.
*
- * * The synchronous methods of [EventSink] were called, resulting in an
- * error. If there is no active future (like from an addStream call), the
- * [done] future will complete with that error
+ * Otherwise, the returned future will complete
+ * when all events have been processed and the sink has been closed,
Anders Johnsen 2014/06/02 10:58:39 ... when: * All events ... or * When the ...
+ * or when the sink has otherwise been stopped from handling more events.
*/
Future get done;
}
« no previous file with comments | « sdk/lib/async/broadcast_stream_controller.dart ('k') | sdk/lib/async/stream_controller.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698