| 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 | 352 |
| 353 typedef void _NotificationHandler(); | 353 typedef void _NotificationHandler(); |
| 354 | 354 |
| 355 void _runGuarded(_NotificationHandler notificationHandler) { | 355 void _runGuarded(_NotificationHandler notificationHandler) { |
| 356 if (notificationHandler == null) return; | 356 if (notificationHandler == null) return; |
| 357 try { | 357 try { |
| 358 notificationHandler(); | 358 notificationHandler(); |
| 359 } catch (e, s) { | 359 } catch (e, s) { |
| 360 _Zone.current.handleUncaughtError(_asyncError(e, s)); | 360 _throwDelayed(e, s); |
| 361 } | 361 } |
| 362 } | 362 } |
| 363 | 363 |
| 364 class _ControllerStream<T> extends _StreamImpl<T> { | 364 class _ControllerStream<T> extends _StreamImpl<T> { |
| 365 _StreamControllerLifecycle<T> _controller; | 365 _StreamControllerLifecycle<T> _controller; |
| 366 bool _hasListener = false; | 366 bool _hasListener = false; |
| 367 | 367 |
| 368 _ControllerStream(this._controller); | 368 _ControllerStream(this._controller); |
| 369 | 369 |
| 370 StreamSubscription<T> _createSubscription( | 370 StreamSubscription<T> _createSubscription( |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 } | 765 } |
| 766 | 766 |
| 767 void _callOnCancel() { | 767 void _callOnCancel() { |
| 768 if (_hasPending) { | 768 if (_hasPending) { |
| 769 _pending.clear(); | 769 _pending.clear(); |
| 770 _pending = null; | 770 _pending = null; |
| 771 } | 771 } |
| 772 super._callOnCancel(); | 772 super._callOnCancel(); |
| 773 } | 773 } |
| 774 } | 774 } |
| OLD | NEW |