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

Unified Diff: webkit/fileapi/file_system_operation.cc

Issue 3743004: Rename FileUtilProxy::Create to EnsureFileExists (Closed)
Patch Set: fixed comments Created 10 years, 2 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 | « webkit/fileapi/file_system_operation.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/file_system_operation.cc
diff --git a/webkit/fileapi/file_system_operation.cc b/webkit/fileapi/file_system_operation.cc
index 6a88b6f3bd19d0c228a295260cdc3b675475a442..0e2e823603ffadaf6ca2635d1102a75e739711be 100644
--- a/webkit/fileapi/file_system_operation.cc
+++ b/webkit/fileapi/file_system_operation.cc
@@ -36,11 +36,10 @@ void FileSystemOperation::CreateFile(const FilePath& path,
pending_operation_ = kOperationCreateFile;
#endif
- base::FileUtilProxy::Create(
- proxy_, path, base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_READ,
- callback_factory_.NewCallback(
- exclusive ? &FileSystemOperation::DidCreateFileExclusive
- : &FileSystemOperation::DidCreateFileNonExclusive));
+ base::FileUtilProxy::EnsureFileExists(
+ proxy_, path, callback_factory_.NewCallback(
+ exclusive ? &FileSystemOperation::DidEnsureFileExistsExclusive
+ : &FileSystemOperation::DidEnsureFileExistsNonExclusive));
}
void FileSystemOperation::CreateDirectory(const FilePath& path,
@@ -219,23 +218,17 @@ void FileSystemOperation::Cancel(FileSystemOperation* cancel_operation) {
}
}
-void FileSystemOperation::DidCreateFileExclusive(
- base::PlatformFileError rv,
- base::PassPlatformFile file,
- bool created) {
- DidFinishFileOperation(rv);
+void FileSystemOperation::DidEnsureFileExistsExclusive(
+ base::PlatformFileError rv, bool created) {
+ if (rv == base::PLATFORM_FILE_OK && !created)
+ dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_EXISTS);
+ else
+ DidFinishFileOperation(rv);
}
-void FileSystemOperation::DidCreateFileNonExclusive(
- base::PlatformFileError rv,
- base::PassPlatformFile file,
- bool created) {
- // Suppress the already exists error and report success.
- if (rv == base::PLATFORM_FILE_OK ||
- rv == base::PLATFORM_FILE_ERROR_EXISTS)
- dispatcher_->DidSucceed();
- else
- dispatcher_->DidFail(rv);
+void FileSystemOperation::DidEnsureFileExistsNonExclusive(
+ base::PlatformFileError rv, bool /* created */) {
+ DidFinishFileOperation(rv);
}
void FileSystemOperation::DidFinishFileOperation(
« no previous file with comments | « webkit/fileapi/file_system_operation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698