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

Unified Diff: pkg/http/lib/src/utils.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: Address comments. 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
« no previous file with comments | « pkg/http/lib/src/streamed_request.dart ('k') | pkg/http/test/mock_client_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/lib/src/utils.dart
diff --git a/pkg/http/lib/src/utils.dart b/pkg/http/lib/src/utils.dart
index bca314d95cf1828fe0f51b6b7b612b8d379d469c..87a78a0aa0e3158c87dbf78b1497f7b8aa210b95 100644
--- a/pkg/http/lib/src/utils.dart
+++ b/pkg/http/lib/src/utils.dart
@@ -155,7 +155,7 @@ Stream onDone(Stream stream, void onDone()) {
ByteStream wrapInputStream(InputStream stream) {
if (stream.closed) return emptyStream;
- var controller = new StreamController.singleSubscription();
+ var controller = new StreamController();
stream.onClosed = controller.close;
stream.onData = () => controller.add(stream.read());
stream.onError = (e) => controller.signalError(new AsyncError(e));
@@ -242,7 +242,7 @@ Stream get emptyStream => streamFromIterable([]);
/// Creates a single-subscription stream that emits the items in [iter] and then
/// ends.
Stream streamFromIterable(Iterable iter) {
- var stream = new StreamController.singleSubscription();
+ var stream = new StreamController();
iter.forEach(stream.add);
stream.close();
return stream.stream;
@@ -253,8 +253,8 @@ Stream streamFromIterable(Iterable iter) {
/// errors from [stream]. This is useful if [stream] is single-subscription but
/// multiple subscribers are necessary.
Pair<Stream, Stream> tee(Stream stream) {
- var controller1 = new StreamController.singleSubscription();
- var controller2 = new StreamController.singleSubscription();
+ var controller1 = new StreamController();
+ var controller2 = new StreamController();
stream.listen((value) {
controller1.add(value);
controller2.add(value);
« no previous file with comments | « pkg/http/lib/src/streamed_request.dart ('k') | pkg/http/test/mock_client_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698