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

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

Issue 14907002: dart:io | Implement asynchronous versions of FileSystemEntity methods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add implementation of FileSystemEntity.type, and refactor error handling. 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 | « sdk/lib/io/directory_impl.dart ('k') | sdk/lib/io/file_system_entity.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 5a7977569adde579fc3057e0c0b030f4c217346a..89af6c3ea7da1cd052212c449df25301df71607a 100644
--- a/sdk/lib/io/file_impl.dart
+++ b/sdk/lib/io/file_impl.dart
@@ -198,29 +198,8 @@ const int _WRITE_LIST_REQUEST = 18;
const int _CREATE_LINK_REQUEST = 19;
const int _DELETE_LINK_REQUEST = 20;
const int _LINK_TARGET_REQUEST = 21;
-
-// Base class for _File and _RandomAccessFile with shared functions.
-class _FileBase {
- bool _isErrorResponse(response) {
- return response is List && response[0] != _SUCCESS_RESPONSE;
- }
-
- _exceptionFromResponse(response, String message) {
- assert(_isErrorResponse(response));
- switch (response[_ERROR_RESPONSE_ERROR_TYPE]) {
- case _ILLEGAL_ARGUMENT_RESPONSE:
- return new ArgumentError();
- case _OSERROR_RESPONSE:
- var err = new OSError(response[_OSERROR_RESPONSE_MESSAGE],
- response[_OSERROR_RESPONSE_ERROR_CODE]);
- return new FileIOException(message, err);
- case _FILE_CLOSED_RESPONSE:
- return new FileIOException("File closed");
- default:
- return new Exception("Unknown error");
- }
- }
-}
+const int _TYPE_REQUEST = 22;
+const int _IDENTICAL_REQUEST = 23;
// TODO(ager): The only reason for this class is that the patching
// mechanism doesn't seem to like patching a private top level
@@ -230,7 +209,7 @@ class _FileUtils {
}
// Class for encapsulating the native implementation of files.
-class _File extends _FileBase implements File {
+class _File implements File {
// Constructor for file.
_File(String this._path) {
if (_path is! String) {
@@ -587,7 +566,7 @@ class _File extends _FileBase implements File {
}
-class _RandomAccessFile extends _FileBase implements RandomAccessFile {
+class _RandomAccessFile implements RandomAccessFile {
_RandomAccessFile(int this._id, String this._path);
Future<RandomAccessFile> close() {
« no previous file with comments | « sdk/lib/io/directory_impl.dart ('k') | sdk/lib/io/file_system_entity.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698