| 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 /** Runs user code and takes actions depending on success or failure. */ | 7 /** Runs user code and takes actions depending on success or failure. */ | 
| 8 _runUserCode(userCode(), | 8 _runUserCode(userCode(), | 
| 9              onSuccess(value), | 9              onSuccess(value), | 
| 10              onError(error, StackTrace stackTrace)) { | 10              onError(error, StackTrace stackTrace)) { | 
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 319     // This test is done early to avoid handling an async error | 319     // This test is done early to avoid handling an async error | 
| 320     // in the _handleData method. | 320     // in the _handleData method. | 
| 321     if (count is! int) throw new ArgumentError(count); | 321     if (count is! int) throw new ArgumentError(count); | 
| 322   } | 322   } | 
| 323 | 323 | 
| 324   StreamSubscription<T> _createSubscription( | 324   StreamSubscription<T> _createSubscription( | 
| 325       void onData(T data), | 325       void onData(T data), | 
| 326       Function onError, | 326       Function onError, | 
| 327       void onDone(), | 327       void onDone(), | 
| 328       bool cancelOnError) { | 328       bool cancelOnError) { | 
| 329     if (_count == 0) { |  | 
| 330       return new _DoneStreamSubscription<T>(onDone); |  | 
| 331     } |  | 
| 332     return new _StateStreamSubscription<T>( | 329     return new _StateStreamSubscription<T>( | 
| 333         this, onData, onError, onDone, cancelOnError, _count); | 330         this, onData, onError, onDone, cancelOnError, _count); | 
| 334   } | 331   } | 
| 335 | 332 | 
| 336   void _handleData(T inputEvent, _EventSink<T> sink) { | 333   void _handleData(T inputEvent, _EventSink<T> sink) { | 
| 337     _StateStreamSubscription<T> subscription = sink; | 334     _StateStreamSubscription<T> subscription = sink; | 
| 338     int count = subscription._count; | 335     int count = subscription._count; | 
| 339     if (count > 0) { | 336     if (count > 0) { | 
| 340       sink._add(inputEvent); | 337       sink._add(inputEvent); | 
| 341       count -= 1; | 338       count -= 1; | 
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 489         _addErrorWithReplacement(sink, e, s); | 486         _addErrorWithReplacement(sink, e, s); | 
| 490         return null; | 487         return null; | 
| 491       } | 488       } | 
| 492       if (!isEqual) { | 489       if (!isEqual) { | 
| 493         sink._add(inputEvent); | 490         sink._add(inputEvent); | 
| 494         _previous = inputEvent; | 491         _previous = inputEvent; | 
| 495       } | 492       } | 
| 496     } | 493     } | 
| 497   } | 494   } | 
| 498 } | 495 } | 
| OLD | NEW | 
|---|