| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 // States shared by single/multi stream implementations. | 7 // States shared by single/multi stream implementations. |
| 8 | 8 |
| 9 /// Initial and default state where the stream can receive and send events. | 9 /// Initial and default state where the stream can receive and send events. |
| 10 const int _STREAM_OPEN = 0; | 10 const int _STREAM_OPEN = 0; |
| (...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 } | 1179 } |
| 1180 if (_timer != null) { | 1180 if (_timer != null) { |
| 1181 _timer.cancel(); | 1181 _timer.cancel(); |
| 1182 _timer = null; | 1182 _timer = null; |
| 1183 } | 1183 } |
| 1184 _pauseCount = 0; | 1184 _pauseCount = 0; |
| 1185 } | 1185 } |
| 1186 } | 1186 } |
| 1187 | 1187 |
| 1188 class _SingleStreamMultiplexer<T> extends _MultiStreamImpl<T> { | 1188 class _SingleStreamMultiplexer<T> extends _MultiStreamImpl<T> { |
| 1189 final _SingleStreamImpl<T> _source; | 1189 final Stream<T> _source; |
| 1190 StreamSubscription<T> _subscription; | 1190 StreamSubscription<T> _subscription; |
| 1191 | 1191 |
| 1192 _SingleStreamMultiplexer(this._source); | 1192 _SingleStreamMultiplexer(this._source); |
| 1193 | 1193 |
| 1194 void _callOnPauseStateChange() { | 1194 void _callOnPauseStateChange() { |
| 1195 if (_isPaused) { | 1195 if (_isPaused) { |
| 1196 if (_subscription != null) { | 1196 if (_subscription != null) { |
| 1197 _subscription.pause(); | 1197 _subscription.pause(); |
| 1198 } | 1198 } |
| 1199 } else { | 1199 } else { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1214 onError: this._signalError, | 1214 onError: this._signalError, |
| 1215 onDone: this._close); | 1215 onDone: this._close); |
| 1216 } else { | 1216 } else { |
| 1217 // TODO(lrn): Check why this can happen. | 1217 // TODO(lrn): Check why this can happen. |
| 1218 if (_subscription == null) return; | 1218 if (_subscription == null) return; |
| 1219 _subscription.cancel(); | 1219 _subscription.cancel(); |
| 1220 _subscription = null; | 1220 _subscription = null; |
| 1221 } | 1221 } |
| 1222 } | 1222 } |
| 1223 } | 1223 } |
| OLD | NEW |