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

Side by Side Diff: sdk/lib/async/stream.dart

Issue 18080019: Make StreamController be a StreamSink, not just an EventSink. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/async/future_impl.dart ('k') | sdk/lib/async/stream_controller.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.async; 5 part of dart.async;
6 6
7 // ------------------------------------------------------------------- 7 // -------------------------------------------------------------------
8 // Core Stream types 8 // Core Stream types
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 10
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 936
937 StreamSubscription<T> listen(void onData(T value), 937 StreamSubscription<T> listen(void onData(T value),
938 { void onError(error), 938 { void onError(error),
939 void onDone(), 939 void onDone(),
940 bool cancelOnError }) { 940 bool cancelOnError }) {
941 return _stream.listen(onData, onError: onError, onDone: onDone, 941 return _stream.listen(onData, onError: onError, onDone: onDone,
942 cancelOnError: cancelOnError); 942 cancelOnError: cancelOnError);
943 } 943 }
944 } 944 }
945 945
946 /**
947 * [EventSink] wrapper that only exposes the [EventSink] interface.
948 */
949 class _EventSinkView<T> extends EventSink<T> {
950 final EventSink<T> _sink;
951
952 _EventSinkView(this._sink);
953
954 void add(T value) { _sink.add(value); }
955 void addError(error) { _sink.addError(error); }
956 void close() { _sink.close(); }
957 }
958
959 946
960 /** 947 /**
961 * The target of a [Stream.pipe] call. 948 * The target of a [Stream.pipe] call.
962 * 949 *
963 * The [Stream.pipe] call will pass itself to this object, and then return 950 * The [Stream.pipe] call will pass itself to this object, and then return
964 * the resulting [Future]. The pipe should complete the future when it's 951 * the resulting [Future]. The pipe should complete the future when it's
965 * done. 952 * done.
966 */ 953 */
967 abstract class StreamConsumer<S> { 954 abstract class StreamConsumer<S> {
968 Future addStream(Stream<S> stream); 955 Future addStream(Stream<S> stream);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 * 1251 *
1265 * If a [moveNext] call has been made, it will complete with `false` as value, 1252 * If a [moveNext] call has been made, it will complete with `false` as value,
1266 * as will all further calls to [moveNext]. 1253 * as will all further calls to [moveNext].
1267 * 1254 *
1268 * If you need to stop listening for values before the stream iterator is 1255 * If you need to stop listening for values before the stream iterator is
1269 * automatically closed, you must call [cancel] to ensure that the stream 1256 * automatically closed, you must call [cancel] to ensure that the stream
1270 * is properly closed. 1257 * is properly closed.
1271 */ 1258 */
1272 void cancel(); 1259 void cancel();
1273 } 1260 }
OLDNEW
« no previous file with comments | « sdk/lib/async/future_impl.dart ('k') | sdk/lib/async/stream_controller.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698