| 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 // Controller for creating and adding events to a stream. | 8 // Controller for creating and adding events to a stream. |
| 9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
| 10 | 10 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 | 272 |
| 273 typedef void _NotificationHandler(); | 273 typedef void _NotificationHandler(); |
| 274 | 274 |
| 275 void _runGuarded(_NotificationHandler notificationHandler) { | 275 void _runGuarded(_NotificationHandler notificationHandler) { |
| 276 if (notificationHandler == null) return; | 276 if (notificationHandler == null) return; |
| 277 try { | 277 try { |
| 278 notificationHandler(); | 278 notificationHandler(); |
| 279 } catch (e, s) { | 279 } catch (e, s) { |
| 280 _throwDelayed(e, s); | 280 _Zone.current.handleUncaughtError(_asyncError(e, s)); |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 | 283 |
| 284 class _ControllerStream<T> extends _StreamImpl<T> { | 284 class _ControllerStream<T> extends _StreamImpl<T> { |
| 285 _StreamControllerLifecycle<T> _controller; | 285 _StreamControllerLifecycle<T> _controller; |
| 286 bool _hasListener = false; | 286 bool _hasListener = false; |
| 287 | 287 |
| 288 _ControllerStream(this._controller); | 288 _ControllerStream(this._controller); |
| 289 | 289 |
| 290 StreamSubscription<T> _createSubscription( | 290 StreamSubscription<T> _createSubscription( |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 link = subscription._next; | 547 link = subscription._next; |
| 548 } | 548 } |
| 549 } | 549 } |
| 550 _state &= ~_STATE_FIRING; | 550 _state &= ~_STATE_FIRING; |
| 551 | 551 |
| 552 if (_isEmpty) { | 552 if (_isEmpty) { |
| 553 _runGuarded(_onCancel); | 553 _runGuarded(_onCancel); |
| 554 } | 554 } |
| 555 } | 555 } |
| 556 } | 556 } |
| OLD | NEW |