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

Side by Side Diff: sdk/lib/async/stream_controller.dart

Issue 598993002: Add missing null-tests to async error functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add co19 issue number to status file. Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/async/stream.dart ('k') | sdk/lib/async/stream_pipe.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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 * handle their own pausing. 161 * handle their own pausing.
162 */ 162 */
163 bool get isPaused; 163 bool get isPaused;
164 164
165 /** Whether there is a subscriber on the [Stream]. */ 165 /** Whether there is a subscriber on the [Stream]. */
166 bool get hasListener; 166 bool get hasListener;
167 167
168 /** 168 /**
169 * Send or enqueue an error event. 169 * Send or enqueue an error event.
170 * 170 *
171 * If [error] is `null`, it is replaced by a [NullThrownError].
172 *
171 * Also allows an objection stack trace object, on top of what [EventSink] 173 * Also allows an objection stack trace object, on top of what [EventSink]
172 * allows. 174 * allows.
173 */ 175 */
174 void addError(Object error, [StackTrace stackTrace]); 176 void addError(Object error, [StackTrace stackTrace]);
175 177
176 /** 178 /**
177 * Receives events from [source] and puts them into this controller's stream. 179 * Receives events from [source] and puts them into this controller's stream.
178 * 180 *
179 * Returns a future which completes when the source stream is done. 181 * Returns a future which completes when the source stream is done.
180 * 182 *
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 */ 409 */
408 void add(T value) { 410 void add(T value) {
409 if (!_mayAddEvent) throw _badEventState(); 411 if (!_mayAddEvent) throw _badEventState();
410 _add(value); 412 _add(value);
411 } 413 }
412 414
413 /** 415 /**
414 * Send or enqueue an error event. 416 * Send or enqueue an error event.
415 */ 417 */
416 void addError(Object error, [StackTrace stackTrace]) { 418 void addError(Object error, [StackTrace stackTrace]) {
419 error = _nonNullError(error);
417 if (!_mayAddEvent) throw _badEventState(); 420 if (!_mayAddEvent) throw _badEventState();
418 AsyncError replacement = Zone.current.errorCallback(error, stackTrace); 421 AsyncError replacement = Zone.current.errorCallback(error, stackTrace);
419 if (replacement != null) { 422 if (replacement != null) {
420 error = replacement.error; 423 error = _nonNullError(replacement.error);
421 stackTrace = replacement.stackTrace; 424 stackTrace = replacement.stackTrace;
422 } 425 }
423 _addError(error, stackTrace); 426 _addError(error, stackTrace);
424 } 427 }
425 428
426 /** 429 /**
427 * Closes this controller and sends a done event on the stream. 430 * Closes this controller and sends a done event on the stream.
428 * 431 *
429 * The first time a controller is closed, a "done" event is added to its 432 * The first time a controller is closed, a "done" event is added to its
430 * stream. 433 * stream.
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 _StreamControllerAddStreamState(_StreamController controller, 794 _StreamControllerAddStreamState(_StreamController controller,
792 this.varData, 795 this.varData,
793 Stream source, 796 Stream source,
794 bool cancelOnError) 797 bool cancelOnError)
795 : super(controller, source, cancelOnError) { 798 : super(controller, source, cancelOnError) {
796 if (controller.isPaused) { 799 if (controller.isPaused) {
797 addSubscription.pause(); 800 addSubscription.pause();
798 } 801 }
799 } 802 }
800 } 803 }
OLDNEW
« no previous file with comments | « sdk/lib/async/stream.dart ('k') | sdk/lib/async/stream_pipe.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698