Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: tool/input_sdk/lib/async/stream_controller.dart

Issue 1554683002: Update to latest analyzer (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tool/input_sdk/lib/async/stream.dart ('k') | tool/input_sdk/lib/collection/iterable.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 * [onResume] call might not be executed. 74 * [onResume] call might not be executed.
75 */ 75 */
76 factory StreamController({void onListen(), 76 factory StreamController({void onListen(),
77 void onPause(), 77 void onPause(),
78 void onResume(), 78 void onResume(),
79 onCancel(), 79 onCancel(),
80 bool sync: false}) { 80 bool sync: false}) {
81 if (onListen == null && onPause == null && 81 if (onListen == null && onPause == null &&
82 onResume == null && onCancel == null) { 82 onResume == null && onCancel == null) {
83 return sync 83 return sync
84 ? new _NoCallbackSyncStreamController/*<T>*/() 84 ? new _NoCallbackSyncStreamController<T>()
85 : new _NoCallbackAsyncStreamController/*<T>*/(); 85 : new _NoCallbackAsyncStreamController<T>();
86 } 86 }
87 return sync 87 return sync
88 ? new _SyncStreamController<T>(onListen, onPause, onResume, onCancel) 88 ? new _SyncStreamController<T>(onListen, onPause, onResume, onCancel)
89 : new _AsyncStreamController<T>(onListen, onPause, onResume, onCancel); 89 : new _AsyncStreamController<T>(onListen, onPause, onResume, onCancel);
90 } 90 }
91 91
92 /** 92 /**
93 * A controller where [stream] can be listened to more than once. 93 * A controller where [stream] can be listened to more than once.
94 * 94 *
95 * The [Stream] returned by [stream] is a broadcast stream. 95 * The [Stream] returned by [stream] is a broadcast stream.
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 this._onCancel()); 643 this._onCancel());
644 } 644 }
645 645
646 abstract class _NoCallbacks { 646 abstract class _NoCallbacks {
647 _NotificationHandler get _onListen => null; 647 _NotificationHandler get _onListen => null;
648 _NotificationHandler get _onPause => null; 648 _NotificationHandler get _onPause => null;
649 _NotificationHandler get _onResume => null; 649 _NotificationHandler get _onResume => null;
650 _NotificationHandler get _onCancel => null; 650 _NotificationHandler get _onCancel => null;
651 } 651 }
652 652
653 class _NoCallbackAsyncStreamController/*<T>*/ = _StreamController/*<T>*/ 653 class _NoCallbackAsyncStreamController<T> = _StreamController<T>
654 with _AsyncStreamControllerDispatch/*<T>*/, _NoCallbacks; 654 with _AsyncStreamControllerDispatch<T>, _NoCallbacks;
655 655
656 class _NoCallbackSyncStreamController/*<T>*/ = _StreamController/*<T>*/ 656 class _NoCallbackSyncStreamController<T> = _StreamController<T>
657 with _SyncStreamControllerDispatch/*<T>*/, _NoCallbacks; 657 with _SyncStreamControllerDispatch<T>, _NoCallbacks;
658 658
659 typedef _NotificationHandler(); 659 typedef _NotificationHandler();
660 660
661 Future _runGuarded(_NotificationHandler notificationHandler) { 661 Future _runGuarded(_NotificationHandler notificationHandler) {
662 if (notificationHandler == null) return null; 662 if (notificationHandler == null) return null;
663 try { 663 try {
664 var result = notificationHandler(); 664 var result = notificationHandler();
665 if (result is Future) return result; 665 if (result is Future) return result;
666 return null; 666 return null;
667 } catch (e, s) { 667 } catch (e, s) {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 _StreamControllerAddStreamState(_StreamController controller, 794 _StreamControllerAddStreamState(_StreamController controller,
795 this.varData, 795 this.varData,
796 Stream source, 796 Stream source,
797 bool cancelOnError) 797 bool cancelOnError)
798 : super(controller, source, cancelOnError) { 798 : super(controller, source, cancelOnError) {
799 if (controller.isPaused) { 799 if (controller.isPaused) {
800 addSubscription.pause(); 800 addSubscription.pause();
801 } 801 }
802 } 802 }
803 } 803 }
OLDNEW
« no previous file with comments | « tool/input_sdk/lib/async/stream.dart ('k') | tool/input_sdk/lib/collection/iterable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698