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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 // constructors in mixin superclasses. | 785 // constructors in mixin superclasses. |
786 | 786 |
787 class _AsyncStreamController<T> = _StreamController<T> | 787 class _AsyncStreamController<T> = _StreamController<T> |
788 with _AsyncStreamControllerDispatch<T>; | 788 with _AsyncStreamControllerDispatch<T>; |
789 | 789 |
790 class _SyncStreamController<T> = _StreamController<T> | 790 class _SyncStreamController<T> = _StreamController<T> |
791 with _SyncStreamControllerDispatch<T>; | 791 with _SyncStreamControllerDispatch<T>; |
792 | 792 |
793 typedef _NotificationHandler(); | 793 typedef _NotificationHandler(); |
794 | 794 |
795 Future _runGuarded(_NotificationHandler notificationHandler) { | 795 void _runGuarded(_NotificationHandler notificationHandler) { |
796 if (notificationHandler == null) return null; | 796 if (notificationHandler == null) return; |
797 try { | 797 try { |
798 var result = notificationHandler(); | 798 notificationHandler(); |
799 if (result is Future) return result; | |
800 return null; | |
801 } catch (e, s) { | 799 } catch (e, s) { |
802 Zone.current.handleUncaughtError(e, s); | 800 Zone.current.handleUncaughtError(e, s); |
803 } | 801 } |
804 } | 802 } |
805 | 803 |
806 class _ControllerStream<T> extends _StreamImpl<T> { | 804 class _ControllerStream<T> extends _StreamImpl<T> { |
807 _StreamControllerLifecycle<T> _controller; | 805 _StreamControllerLifecycle<T> _controller; |
808 | 806 |
809 _ControllerStream(this._controller); | 807 _ControllerStream(this._controller); |
810 | 808 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 var varData; | 925 var varData; |
928 | 926 |
929 _StreamControllerAddStreamState(_StreamController<T> controller, this.varData, | 927 _StreamControllerAddStreamState(_StreamController<T> controller, this.varData, |
930 Stream source, bool cancelOnError) | 928 Stream source, bool cancelOnError) |
931 : super(controller, source, cancelOnError) { | 929 : super(controller, source, cancelOnError) { |
932 if (controller.isPaused) { | 930 if (controller.isPaused) { |
933 addSubscription.pause(); | 931 addSubscription.pause(); |
934 } | 932 } |
935 } | 933 } |
936 } | 934 } |
OLD | NEW |