Index: webkit/browser/fileapi/native_file_util.cc |
diff --git a/webkit/browser/fileapi/native_file_util.cc b/webkit/browser/fileapi/native_file_util.cc |
index e99e29770000dfad9cb0bcafeda9c4c182b154ca..5fb51da381ed7ae0a23965122423bb0550be0a3d 100644 |
--- a/webkit/browser/fileapi/native_file_util.cc |
+++ b/webkit/browser/fileapi/native_file_util.cc |
@@ -122,9 +122,10 @@ NativeFileUtil::CopyOrMoveMode NativeFileUtil::CopyOrMoveModeForDestination( |
return MOVE; |
} |
-base::File::Error NativeFileUtil::CreateOrOpen( |
- const base::FilePath& path, int file_flags, |
- PlatformFile* file_handle, bool* created) { |
+base::File::Error NativeFileUtil::CreateOrOpen(const base::FilePath& path, |
+ int file_flags, |
+ base::File* file) { |
+ DCHECK(!file->IsValid()); |
if (!base::DirectoryExists(path.DirName())) { |
rvargas (doing something else)
2014/03/21 22:39:21
Is there a platform where this would not fail duri
kinuko
2014/03/24 09:56:58
The latter. (The main purpose of having this thin
rvargas (doing something else)
2014/03/24 23:02:48
I'm still curious about it. Are we promising a par
kinuko
2014/03/25 03:15:26
These error codes are basically following this spe
rvargas (doing something else)
2014/03/26 00:35:46
There are not that many error codes on that doc so
|
// If its parent does not exist, should return NOT_FOUND error. |
return base::File::FILE_ERROR_NOT_FOUND; |
@@ -132,17 +133,10 @@ base::File::Error NativeFileUtil::CreateOrOpen( |
if (base::DirectoryExists(path)) |
return base::File::FILE_ERROR_NOT_A_FILE; |
rvargas (doing something else)
2014/03/21 22:39:21
Maybe there should be an explicit flag for opening
|
- // TODO(rvargas): convert this code to use base::File. |
- base::PlatformFileError error_code = base::PLATFORM_FILE_OK; |
- *file_handle = base::CreatePlatformFile(path, file_flags, |
- created, &error_code); |
- return static_cast<base::File::Error>(error_code); |
-} |
- |
-base::File::Error NativeFileUtil::Close(PlatformFile file_handle) { |
- if (!base::ClosePlatformFile(file_handle)) |
- return base::File::FILE_ERROR_FAILED; |
- return base::File::FILE_OK; |
+ *file = base::File(path, file_flags); |
+ if (file->IsValid()) |
+ return base::File::FILE_OK; |
+ return file->error_details(); |
} |
base::File::Error NativeFileUtil::EnsureFileExists( |