Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1162)

Unified Diff: sdk/lib/io/file_impl.dart

Issue 14611007: Don't use length when reading a file in chunks (but continue to EOF). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/file_impl.dart
diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart
index ef467ac5577b40c05aab9fa7709fb07cfda4c0b2..57cfda6545d55486946c08df97aed2ddcb170af6 100644
--- a/sdk/lib/io/file_impl.dart
+++ b/sdk/lib/io/file_impl.dart
@@ -71,22 +71,14 @@ class _FileStream extends Stream<List<int>> {
// Don't start a new read if one is already in progress.
if (_readInProgress) return;
_readInProgress = true;
- _openedFile.length()
- .then((length) {
- if (_position >= length) {
- _readInProgress = false;
+ _openedFile.read(_BLOCK_SIZE)
+ .then((block) {
+ _readInProgress = false;
+ if (block.length == 0) {
if (!_unsubscribed) {
_closeFile().then((_) { _controller.close(); });
_unsubscribed = true;
}
- return null;
- } else {
- return _openedFile.read(_BLOCK_SIZE);
- }
- })
- .then((block) {
- _readInProgress = false;
- if (block == null || _unsubscribed) {
return;
}
_position += block.length;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698