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

Side by Side Diff: pkg/scheduled_test/lib/src/utils.dart

Issue 12610006: Renamed StreamSink to EventSink. Renamed signalError to addError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changed inheritance back! Now create StreamSink instead of EventSink where we create them. 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 unified diff | Download patch | Annotate | Revision Log
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 library utils; 5 library utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 /// Configures [future] so that its result (success or exception) is passed on 9 /// Configures [future] so that its result (success or exception) is passed on
10 /// to [completer]. 10 /// to [completer].
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 Stream errorStream(error) => new Future.immediateError(error).asStream(); 45 Stream errorStream(error) => new Future.immediateError(error).asStream();
46 46
47 /// Returns a buffered stream that will emit the same values as the stream 47 /// Returns a buffered stream that will emit the same values as the stream
48 /// returned by [future] once [future] completes. If [future] completes to an 48 /// returned by [future] once [future] completes. If [future] completes to an
49 /// error, the return value will emit that error and then close. 49 /// error, the return value will emit that error and then close.
50 Stream futureStream(Future<Stream> future) { 50 Stream futureStream(Future<Stream> future) {
51 var controller = new StreamController(); 51 var controller = new StreamController();
52 future.then((stream) { 52 future.then((stream) {
53 stream.listen( 53 stream.listen(
54 controller.add, 54 controller.add,
55 onError: (error) => controller.signalError(error), 55 onError: (error) => controller.addError(error),
56 onDone: controller.close); 56 onDone: controller.close);
57 }).catchError((e) { 57 }).catchError((e) {
58 controller.signalError(e); 58 controller.addError(e);
59 controller.close(); 59 controller.close();
60 }); 60 });
61 return controller.stream; 61 return controller.stream;
62 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698