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

Unified Diff: base/files/file_util_proxy.cc

Issue 227433006: Remove CreatePlatformFile from file_util_proxy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | base/files/file_util_proxy_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_util_proxy.cc
diff --git a/base/files/file_util_proxy.cc b/base/files/file_util_proxy.cc
index 447552ddaf0384e21f97ab72e55ffaea79bbe56b..0a86393098f5d0ff7c39861e232435a17e73914c 100644
--- a/base/files/file_util_proxy.cc
+++ b/base/files/file_util_proxy.cc
@@ -90,15 +90,15 @@ class CreateTemporaryHelper {
PLATFORM_FILE_CREATE_ALWAYS |
additional_file_flags;
- error_ = File::FILE_OK;
- // TODO(rvargas): Convert this code to use File.
- file_handle_ =
- CreatePlatformFile(file_path_, file_flags, NULL,
- reinterpret_cast<PlatformFileError*>(&error_));
- if (error_ != File::FILE_OK) {
+ File file(file_path_, file_flags);
+ if (!file.IsValid()) {
base::DeleteFile(file_path_, false);
file_path_.clear();
+ error_ = file.error_details();
+ return;
}
+ error_ = File::FILE_OK;
+ file_handle_ = file.TakePlatformFile();
}
void Reply(const FileUtilProxy::CreateTemporaryCallback& callback) {
@@ -212,11 +212,14 @@ File::Error CreateOrOpenAdapter(
// If its parent does not exist, should return NOT_FOUND error.
return File::FILE_ERROR_NOT_FOUND;
}
- File::Error error = File::FILE_OK;
- *file_handle =
- CreatePlatformFile(file_path, file_flags, created,
- reinterpret_cast<PlatformFileError*>(&error));
- return error;
+
+ File file(file_path, file_flags);
+ if (!file.IsValid())
+ return file.error_details();
+
+ *file_handle = file.TakePlatformFile();
+ *created = file.created();
+ return File::FILE_OK;
}
File::Error CloseAdapter(PlatformFile file_handle) {
« no previous file with comments | « no previous file | base/files/file_util_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698