| 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 /** | 7 /** |
| 8 * A pipe between two streams. | 8 * A pipe between two streams. |
| 9 * | 9 * |
| 10 * The default pipe subscribes to the [source] and sends on the | 10 * The default pipe subscribes to the [source] and sends on the |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 * [stream] has subscribers. | 49 * [stream] has subscribers. |
| 50 */ | 50 */ |
| 51 void _onSubscriptionStateChange() { | 51 void _onSubscriptionStateChange() { |
| 52 if (_hasSubscribers) { | 52 if (_hasSubscribers) { |
| 53 assert(_subscription == null); | 53 assert(_subscription == null); |
| 54 if (_source != null) { | 54 if (_source != null) { |
| 55 _subscribeToSource(); | 55 _subscribeToSource(); |
| 56 } | 56 } |
| 57 } else { | 57 } else { |
| 58 if (_subscription != null) { | 58 if (_subscription != null) { |
| 59 _subscription.unsubscribe(); | 59 _subscription.cancel(); |
| 60 _subscription = null; | 60 _subscription = null; |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 void _onPauseStateChange() { | 65 void _onPauseStateChange() { |
| 66 if (_subscription == null) return; | 66 if (_subscription == null) return; |
| 67 if (isPaused) { | 67 if (isPaused) { |
| 68 _subscription.pause(); | 68 _subscription.pause(); |
| 69 } else { | 69 } else { |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 _signalError(new AsyncError(e, s)); | 451 _signalError(new AsyncError(e, s)); |
| 452 return null; | 452 return null; |
| 453 } | 453 } |
| 454 if (!isEqual) { | 454 if (!isEqual) { |
| 455 _add(inputEvent); | 455 _add(inputEvent); |
| 456 _previous = inputEvent; | 456 _previous = inputEvent; |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 } | 459 } |
| 460 } | 460 } |
| OLD | NEW |