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

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

Issue 1320023008: Refactor the io resource classes (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: address comments Created 5 years, 3 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 | « runtime/observatory/tests/service/tcp_socket_service_test.dart ('k') | sdk/lib/io/io_resource_info.dart » ('j') | 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 2164bc94a02b5a6d33fa76e9c31015ef13a41724..6b0dc96789ae8626baf5c27948ad74ed8834ea7d 100644
--- a/sdk/lib/io/file_impl.dart
+++ b/sdk/lib/io/file_impl.dart
@@ -632,8 +632,7 @@ class _RandomAccessFile
if (_isErrorResponse(response)) {
throw _exceptionFromResponse(response, "readByte failed", path);
}
- _resourceInfo.readCount++;
- _resourceInfo.totalRead++;
+ _resourceInfo.addRead(1);
return response;
});
}
@@ -646,8 +645,7 @@ class _RandomAccessFile
if (result is OSError) {
throw new FileSystemException("readByte failed", path, result);
}
- _resourceInfo.readCount++;
- _resourceInfo.totalRead++;
+ _resourceInfo.addRead(1);
return result;
}
@@ -659,8 +657,7 @@ class _RandomAccessFile
if (_isErrorResponse(response)) {
throw _exceptionFromResponse(response, "read failed", path);
}
- _resourceInfo.readCount++;
- _resourceInfo.totalRead += response[1].length;
+ _resourceInfo.addRead(response[1].length);
return response[1];
});
}
@@ -676,8 +673,7 @@ class _RandomAccessFile
if (result is OSError) {
throw new FileSystemException("readSync failed", path, result);
}
- _resourceInfo.readCount++;
- _resourceInfo.totalRead += result.length;
+ _resourceInfo.addRead(result.length);
return result;
}
@@ -697,8 +693,7 @@ class _RandomAccessFile
var read = response[1];
var data = response[2];
buffer.setRange(start, start + read, data);
- _resourceInfo.readCount++;
- _resourceInfo.totalRead += read;
+ _resourceInfo.addRead(read);
return read;
});
}
@@ -718,8 +713,7 @@ class _RandomAccessFile
if (result is OSError) {
throw new FileSystemException("readInto failed", path, result);
}
- _resourceInfo.readCount++;
- _resourceInfo.totalRead += result;
+ _resourceInfo.addRead(result);
return result;
}
@@ -731,8 +725,7 @@ class _RandomAccessFile
if (_isErrorResponse(response)) {
throw _exceptionFromResponse(response, "writeByte failed", path);
}
- _resourceInfo.writeCount++;
- _resourceInfo.totalWritten++;
+ _resourceInfo.addWrite(1);
return this;
});
}
@@ -748,8 +741,7 @@ class _RandomAccessFile
if (result is OSError) {
throw new FileSystemException("writeByte failed", path, result);
}
- _resourceInfo.writeCount++;
- _resourceInfo.totalWritten++;
+ _resourceInfo.addWrite(1);
return result;
}
@@ -778,8 +770,7 @@ class _RandomAccessFile
if (_isErrorResponse(response)) {
throw _exceptionFromResponse(response, "writeFrom failed", path);
}
- _resourceInfo.writeCount++;
- _resourceInfo.totalWritten += end - (start - result.start);
+ _resourceInfo.addWrite(end - (start - result.start));
return this;
});
}
@@ -804,8 +795,7 @@ class _RandomAccessFile
if (result is OSError) {
throw new FileSystemException("writeFrom failed", path, result);
}
- _resourceInfo.writeCount++;
- _resourceInfo.totalWritten += end - (start - bufferAndStart.start);
+ _resourceInfo.addWrite(end - (start - bufferAndStart.start));
}
Future<RandomAccessFile> writeString(String string,
« no previous file with comments | « runtime/observatory/tests/service/tcp_socket_service_test.dart ('k') | sdk/lib/io/io_resource_info.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698