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 /** Runs user code and takes actions depending on success or failure. */ | 7 /** Runs user code and takes actions depending on success or failure. */ |
8 _runUserCode(userCode(), | 8 _runUserCode(userCode(), |
9 onSuccess(value), | 9 onSuccess(value), |
10 onError(error, StackTrace stackTrace)) { | 10 onError(error, StackTrace stackTrace)) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 void _onResume() { | 155 void _onResume() { |
156 if (_subscription == null) return; | 156 if (_subscription == null) return; |
157 _subscription.resume(); | 157 _subscription.resume(); |
158 } | 158 } |
159 | 159 |
160 Future _onCancel() { | 160 Future _onCancel() { |
161 if (_subscription != null) { | 161 if (_subscription != null) { |
162 StreamSubscription subscription = _subscription; | 162 StreamSubscription subscription = _subscription; |
163 _subscription = null; | 163 _subscription = null; |
164 subscription.cancel(); | 164 return subscription.cancel(); |
165 } | 165 } |
166 return null; | 166 return null; |
167 } | 167 } |
168 | 168 |
169 // Methods used as listener on source subscription. | 169 // Methods used as listener on source subscription. |
170 | 170 |
171 void _handleData(S data) { | 171 void _handleData(S data) { |
172 _stream._handleData(data, this); | 172 _stream._handleData(data, this); |
173 } | 173 } |
174 | 174 |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 _addErrorWithReplacement(sink, e, s); | 482 _addErrorWithReplacement(sink, e, s); |
483 return null; | 483 return null; |
484 } | 484 } |
485 if (!isEqual) { | 485 if (!isEqual) { |
486 sink._add(inputEvent); | 486 sink._add(inputEvent); |
487 _previous = inputEvent; | 487 _previous = inputEvent; |
488 } | 488 } |
489 } | 489 } |
490 } | 490 } |
491 } | 491 } |
OLD | NEW |