| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Core Stream types | 8 // Core Stream types |
| 9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
| 10 | 10 |
| (...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 if (onTimeout == null) { | 1307 if (onTimeout == null) { |
| 1308 timeout = () { | 1308 timeout = () { |
| 1309 controller.addError( | 1309 controller.addError( |
| 1310 new TimeoutException("No stream event", timeLimit), null); | 1310 new TimeoutException("No stream event", timeLimit), null); |
| 1311 }; | 1311 }; |
| 1312 } else { | 1312 } else { |
| 1313 // TODO(floitsch): the return type should be 'void', and the type | 1313 // TODO(floitsch): the return type should be 'void', and the type |
| 1314 // should be inferred. | 1314 // should be inferred. |
| 1315 var registeredOnTimeout = | 1315 var registeredOnTimeout = |
| 1316 zone.registerUnaryCallback<dynamic, EventSink<T>>(onTimeout); | 1316 zone.registerUnaryCallback<dynamic, EventSink<T>>(onTimeout); |
| 1317 _ControllerEventSinkWrapper wrapper = | 1317 var wrapper = new _ControllerEventSinkWrapper<T>(null); |
| 1318 new _ControllerEventSinkWrapper(null); | |
| 1319 timeout = () { | 1318 timeout = () { |
| 1320 wrapper._sink = controller; // Only valid during call. | 1319 wrapper._sink = controller; // Only valid during call. |
| 1321 zone.runUnaryGuarded(registeredOnTimeout, wrapper); | 1320 zone.runUnaryGuarded(registeredOnTimeout, wrapper); |
| 1322 wrapper._sink = null; | 1321 wrapper._sink = null; |
| 1323 }; | 1322 }; |
| 1324 } | 1323 } |
| 1325 | 1324 |
| 1326 subscription = this.listen(onData, onError: onError, onDone: onDone); | 1325 subscription = this.listen(onData, onError: onError, onDone: onDone); |
| 1327 timer = zone.createTimer(timeLimit, timeout); | 1326 timer = zone.createTimer(timeLimit, timeout); |
| 1328 } | 1327 } |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1789 } | 1788 } |
| 1790 | 1789 |
| 1791 void addError(error, [StackTrace stackTrace]) { | 1790 void addError(error, [StackTrace stackTrace]) { |
| 1792 _sink.addError(error, stackTrace); | 1791 _sink.addError(error, stackTrace); |
| 1793 } | 1792 } |
| 1794 | 1793 |
| 1795 void close() { | 1794 void close() { |
| 1796 _sink.close(); | 1795 _sink.close(); |
| 1797 } | 1796 } |
| 1798 } | 1797 } |
| OLD | NEW |