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

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

Issue 14051005: Remove deprecated CollectionSink and Stream.pipeInto. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/async/collection_sink.dart ('k') | tests/lib/async/stream_controller_async_test.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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 onError: (AsyncError e) { 303 onError: (AsyncError e) {
304 result._setError(e); 304 result._setError(e);
305 }, 305 },
306 onDone: () { 306 onDone: () {
307 result._setValue(value); 307 result._setValue(value);
308 }, 308 },
309 unsubscribeOnError: true); 309 unsubscribeOnError: true);
310 return result; 310 return result;
311 } 311 }
312 312
313 // Deprecated method, previously called 'pipe', retained for compatibility.
314 Future pipeInto(EventSink<T> sink,
315 {void onError(AsyncError error),
316 bool unsubscribeOnError}) {
317 _FutureImpl<T> result = new _FutureImpl<T>();
318 this.listen(
319 sink.add,
320 onError: sink.addError,
321 onDone: () {
322 sink.close();
323 result._setValue(null);
324 },
325 unsubscribeOnError: unsubscribeOnError);
326 return result;
327 }
328
329
330 /** 313 /**
331 * Checks whether [match] occurs in the elements provided by this stream. 314 * Checks whether [match] occurs in the elements provided by this stream.
332 * 315 *
333 * Completes the [Future] when the answer is known. 316 * Completes the [Future] when the answer is known.
334 * If this stream reports an error, the [Future] will report that error. 317 * If this stream reports an error, the [Future] will report that error.
335 */ 318 */
336 Future<bool> contains(T match) { 319 Future<bool> contains(T match) {
337 _FutureImpl<bool> future = new _FutureImpl<bool>(); 320 _FutureImpl<bool> future = new _FutureImpl<bool>();
338 StreamSubscription subscription; 321 StreamSubscription subscription;
339 subscription = this.listen( 322 subscription = this.listen(
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 1142
1160 /* TODO(8997): Implement EventSink instead, */ 1143 /* TODO(8997): Implement EventSink instead, */
1161 class _EventOutputSinkWrapper<T> extends StreamSink<T> { 1144 class _EventOutputSinkWrapper<T> extends StreamSink<T> {
1162 _EventOutputSink _sink; 1145 _EventOutputSink _sink;
1163 _EventOutputSinkWrapper(this._sink); 1146 _EventOutputSinkWrapper(this._sink);
1164 1147
1165 void add(T data) { _sink._sendData(data); } 1148 void add(T data) { _sink._sendData(data); }
1166 void addError(AsyncError error) { _sink._sendError(error); } 1149 void addError(AsyncError error) { _sink._sendError(error); }
1167 void close() { _sink._sendDone(); } 1150 void close() { _sink._sendDone(); }
1168 } 1151 }
OLDNEW
« no previous file with comments | « sdk/lib/async/collection_sink.dart ('k') | tests/lib/async/stream_controller_async_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698