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 /** Utility function to create an [AsyncError] if [error] isn't one already. */ | 7 /** Utility function to create an [AsyncError] if [error] isn't one already. */ |
8 AsyncError _asyncError(Object error, Object stackTrace, [AsyncError cause]) { | 8 AsyncError _asyncError(Object error, Object stackTrace, [AsyncError cause]) { |
9 if (error is AsyncError) return error; | 9 if (error is AsyncError) return error; |
10 if (cause == null) return new AsyncError(error, stackTrace); | 10 if (cause == null) return new AsyncError(error, stackTrace); |
(...skipping 22 matching lines...) Expand all Loading... | |
33 _cancelAndError(StreamSubscription subscription, _FutureImpl future) => | 33 _cancelAndError(StreamSubscription subscription, _FutureImpl future) => |
34 (AsyncError error) { | 34 (AsyncError error) { |
35 subscription.cancel(); | 35 subscription.cancel(); |
36 future._setError(error); | 36 future._setError(error); |
37 }; | 37 }; |
38 | 38 |
39 | 39 |
40 /** | 40 /** |
41 * A wrapper around a stream that allows independent subscribers. | 41 * A wrapper around a stream that allows independent subscribers. |
42 * | 42 * |
43 * By default [this] subscribes to [_source] and forwards all events to its own | 43 * By default [:this:] subscribes to [_source] and forwards all events to its ow n |
floitsch
2013/01/14 16:31:24
80chars.
If 'this' is not available yet, we shoul
Lasse Reichstein Nielsen
2013/01/15 08:52:54
It's not that "this" is not available *yet*, it is
| |
44 * subscribers. It does not subscribe until there is a subscriber, and | 44 * subscribers. It does not subscribe until there is a subscriber, and |
45 * unsubscribes again when there are no subscribers left. | 45 * unsubscribes again when there are no subscribers left. |
46 * | 46 * |
47 * The events are passed through the [_handleData], [_handleError] and | 47 * The events are passed through the [_handleData], [_handleError] and |
48 * [_handleDone] methods. Subclasses are supposed to add handling of some of | 48 * [_handleDone] methods. Subclasses are supposed to add handling of some of |
49 * the events by overriding these methods. | 49 * the events by overriding these methods. |
50 * | 50 * |
51 * This class is intended for internal use only. | 51 * This class is intended for internal use only. |
52 */ | 52 */ |
53 class _ForwardingMultiStream<S, T> extends _MultiStreamImpl<T> { | 53 class _ForwardingMultiStream<S, T> extends _MultiStreamImpl<T> { |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
500 _signalError(_asyncError(e, s)); | 500 _signalError(_asyncError(e, s)); |
501 return null; | 501 return null; |
502 } | 502 } |
503 if (!isEqual) { | 503 if (!isEqual) { |
504 _add(inputEvent); | 504 _add(inputEvent); |
505 _previous = inputEvent; | 505 _previous = inputEvent; |
506 } | 506 } |
507 } | 507 } |
508 } | 508 } |
509 } | 509 } |
OLD | NEW |