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

Unified Diff: utils/pub/io.dart

Issue 11887016: Make StreamController's unnamed constructor create a single-sub stream. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
Index: utils/pub/io.dart
diff --git a/utils/pub/io.dart b/utils/pub/io.dart
index 665680e828ebc871f4c4cec1e81cc2a4fd8680ac..35dfe63f2c7abcad8eba79c6099b5dd80c365dd2 100644
--- a/utils/pub/io.dart
+++ b/utils/pub/io.dart
@@ -563,8 +563,11 @@ Future<String> consumeStringInputStream(StringInputStream stream) {
/// Wraps [stream] in a single-subscription [Stream] that emits the same data.
Stream<List<int>> wrapInputStream(InputStream stream) {
- var controller = new StreamController.singleSubscription();
- if (stream.closed) return controller..close();
+ var controller = new StreamController();
+ if (stream.closed) {
+ controller.close();
+ return controller.stream;
+ }
stream.onClosed = controller.close;
stream.onData = () => controller.add(stream.read());
« sdk/lib/async/stream.dart ('K') | « tests/lib/async/stream_single_to_multi_subscriber_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698