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

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

Issue 12313127: Fix subscription handling in stream decoder (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added missing file 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
« no previous file with comments | « no previous file | sdk/lib/io/file_impl.dart » ('j') | sdk/lib/io/string_transformer.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, 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
11 /** 11 /**
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 EventTransformStream(Stream<S> source, 1009 EventTransformStream(Stream<S> source,
1010 StreamEventTransformer<S, T> transformer) 1010 StreamEventTransformer<S, T> transformer)
1011 : _source = source, _transformer = transformer; 1011 : _source = source, _transformer = transformer;
1012 1012
1013 StreamSubscription<T> listen(void onData(T data), 1013 StreamSubscription<T> listen(void onData(T data),
1014 { void onError(AsyncError error), 1014 { void onError(AsyncError error),
1015 void onDone(), 1015 void onDone(),
1016 bool unsubscribeOnError }) { 1016 bool unsubscribeOnError }) {
1017 return new _EventTransformStreamSubscription(_source, _transformer, 1017 return new _EventTransformStreamSubscription(_source, _transformer,
1018 onData, onError, onDone, 1018 onData, onError, onDone,
1019 unsubscribeOnError); 1019 true == unsubscribeOnError);
floitsch 2013/02/26 14:47:26 I prefer identical(unsubscribeOnError, true) to sw
Søren Gjesse 2013/02/26 15:23:33 Done.
1020 } 1020 }
1021 } 1021 }
1022 1022
1023 class _EventTransformStreamSubscription<S, T> 1023 class _EventTransformStreamSubscription<S, T>
1024 extends _BaseStreamSubscription<T> 1024 extends _BaseStreamSubscription<T>
1025 implements _StreamOutputSink<T> { 1025 implements _StreamOutputSink<T> {
1026 /** The transformer used to transform events. */ 1026 /** The transformer used to transform events. */
1027 final StreamEventTransformer<S, T> _transformer; 1027 final StreamEventTransformer<S, T> _transformer;
1028 /** Whether to unsubscribe when emitting an error. */ 1028 /** Whether to unsubscribe when emitting an error. */
1029 final bool _unsubscribeOnError; 1029 final bool _unsubscribeOnError;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1104 } 1104 }
1105 1105
1106 class _StreamOutputSinkWrapper<T> implements StreamSink<T> { 1106 class _StreamOutputSinkWrapper<T> implements StreamSink<T> {
1107 _StreamOutputSink _sink; 1107 _StreamOutputSink _sink;
1108 _StreamOutputSinkWrapper(this._sink); 1108 _StreamOutputSinkWrapper(this._sink);
1109 1109
1110 void add(T data) => _sink._sendData(data); 1110 void add(T data) => _sink._sendData(data);
1111 void signalError(AsyncError error) => _sink._sendError(error); 1111 void signalError(AsyncError error) => _sink._sendError(error);
1112 void close() => _sink._sendDone(); 1112 void close() => _sink._sendDone();
1113 } 1113 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/io/file_impl.dart » ('j') | sdk/lib/io/string_transformer.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698