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