| 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 /** Abstract and private interface for a place to put events. */ |     7 /** Abstract and private interface for a place to put events. */ | 
|     8 abstract class _EventSink<T> { |     8 abstract class _EventSink<T> { | 
|     9   void _add(T data); |     9   void _add(T data); | 
|    10   void _addError(Object error, StackTrace stackTrace); |    10   void _addError(Object error, StackTrace stackTrace); | 
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   505    */ |   505    */ | 
|   506   _GeneratedStreamImpl(this._pending); |   506   _GeneratedStreamImpl(this._pending); | 
|   507  |   507  | 
|   508   StreamSubscription _createSubscription( |   508   StreamSubscription _createSubscription( | 
|   509       void onData(T data), |   509       void onData(T data), | 
|   510       Function onError, |   510       Function onError, | 
|   511       void onDone(), |   511       void onDone(), | 
|   512       bool cancelOnError) { |   512       bool cancelOnError) { | 
|   513     if (_isUsed) throw new StateError("Stream has already been listened to."); |   513     if (_isUsed) throw new StateError("Stream has already been listened to."); | 
|   514     _isUsed = true; |   514     _isUsed = true; | 
|   515     return new _BufferingStreamSubscription( |   515     return new _BufferingStreamSubscription<T>( | 
|   516         onData, onError, onDone, cancelOnError).._setPendingEvents(_pending()); |   516         onData, onError, onDone, cancelOnError).._setPendingEvents(_pending()); | 
|   517   } |   517   } | 
|   518 } |   518 } | 
|   519  |   519  | 
|   520  |   520  | 
|   521 /** Pending events object that gets its events from an [Iterable]. */ |   521 /** Pending events object that gets its events from an [Iterable]. */ | 
|   522 class _IterablePendingEvents<T> extends _PendingEvents { |   522 class _IterablePendingEvents<T> extends _PendingEvents { | 
|   523   // The iterator providing data for data events. |   523   // The iterator providing data for data events. | 
|   524   // Set to null when iteration has completed. |   524   // Set to null when iteration has completed. | 
|   525   Iterator<T> _iterator; |   525   Iterator<T> _iterator; | 
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1086 class _EmptyStream<T> extends Stream<T> { |  1086 class _EmptyStream<T> extends Stream<T> { | 
|  1087   const _EmptyStream() : super._internal(); |  1087   const _EmptyStream() : super._internal(); | 
|  1088   bool get isBroadcast => true; |  1088   bool get isBroadcast => true; | 
|  1089   StreamSubscription<T> listen(void onData(T data), |  1089   StreamSubscription<T> listen(void onData(T data), | 
|  1090                                {Function onError, |  1090                                {Function onError, | 
|  1091                                 void onDone(), |  1091                                 void onDone(), | 
|  1092                                 bool cancelOnError}) { |  1092                                 bool cancelOnError}) { | 
|  1093     return new _DoneStreamSubscription<T>(onDone); |  1093     return new _DoneStreamSubscription<T>(onDone); | 
|  1094   } |  1094   } | 
|  1095 } |  1095 } | 
| OLD | NEW |