summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-24 01:05:21 +0000
committerrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-24 01:05:21 +0000
commit6efb8d9cb21515fd0d4b4c2b6664cd44e7809c24 (patch)
treefac66471ff98b29ec4c74f4a0fd2f4316df48ed8 /webkit
parentafbee36d83e71dfe1dac945a268256281c1cee95 (diff)
downloadchromium_src-6efb8d9cb21515fd0d4b4c2b6664cd44e7809c24.zip
chromium_src-6efb8d9cb21515fd0d4b4c2b6664cd44e7809c24.tar.gz
chromium_src-6efb8d9cb21515fd0d4b4c2b6664cd44e7809c24.tar.bz2
Remove PlatformFile from fileapi::FileSystemOperation
BUG=322664 Review URL: https://codereview.chromium.org/291513003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272661 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/browser/fileapi/file_system_operation.h50
-rw-r--r--webkit/browser/fileapi/file_system_operation_impl.cc20
-rw-r--r--webkit/browser/fileapi/file_system_operation_runner.cc20
-rw-r--r--webkit/browser/fileapi/file_system_operation_runner.h3
-rw-r--r--webkit/browser/fileapi/obfuscated_file_util.cc2
5 files changed, 39 insertions, 56 deletions
diff --git a/webkit/browser/fileapi/file_system_operation.h b/webkit/browser/fileapi/file_system_operation.h
index cc35be4..4261a2b 100644
--- a/webkit/browser/fileapi/file_system_operation.h
+++ b/webkit/browser/fileapi/file_system_operation.h
@@ -10,7 +10,6 @@
#include "base/callback.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
-#include "base/platform_file.h"
#include "base/process/process.h"
#include "webkit/browser/fileapi/file_system_operation_context.h"
#include "webkit/browser/webkit_storage_browser_export.h"
@@ -75,12 +74,11 @@ class FileSystemOperation {
void(base::File::Error result,
const base::File::Info& file_info)> GetMetadataCallback;
- // Used for OpenFile(). |result| is the return code of the operation.
- // |on_close_callback| will be called after the file is closed in the child
- // process. It can be null, if no operation is needed on closing a file.
+ // Used for OpenFile(). |on_close_callback| will be called after the file is
+ // closed in the child process. It can be null, if no operation is needed on
+ // closing a file.
typedef base::Callback<
- void(base::File::Error result,
- base::PlatformFile file,
+ void(base::File file,
const base::Closure& on_close_callback)> OpenFileCallback;
// Used for ReadDirectoryCallback.
@@ -330,11 +328,11 @@ class FileSystemOperation {
//
// // Dispatch ABORT error for the current operation by invoking
// // the callback function for the ongoing operation,
- // operation_callback.Run(base::PLATFORM_FILE_ERROR_ABORT, ...);
+ // operation_callback.Run(base::File::FILE_ERROR_ABORT, ...);
//
// // Dispatch 'success' for the cancel (or dispatch appropriate
// // error code with DidFail() if the cancel has somehow failed).
- // cancel_callback.Run(base::PLATFORM_FILE_OK);
+ // cancel_callback.Run(base::File::FILE_OK);
// }
//
// Note that, for reporting failure, the callback function passed to a
@@ -353,7 +351,7 @@ class FileSystemOperation {
const StatusCallback& callback) = 0;
// Opens a file at |path| with |file_flags|, where flags are OR'ed
- // values of base::PlatformFileFlags.
+ // values of base::File::Flags.
//
// This function is used only by Pepper as of writing.
virtual void OpenFile(const FileSystemURL& path,
@@ -374,11 +372,11 @@ class FileSystemOperation {
// Copies in a single file from a different filesystem.
//
// This returns:
- // - PLATFORM_FILE_ERROR_NOT_FOUND if |src_file_path|
+ // - File::FILE_ERROR_NOT_FOUND if |src_file_path|
// or the parent directory of |dest_url| does not exist.
- // - PLATFORM_FILE_ERROR_INVALID_OPERATION if |dest_url| exists and
+ // - File::FILE_ERROR_INVALID_OPERATION if |dest_url| exists and
// is not a file.
- // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and
+ // - File::FILE_ERROR_FAILED if |dest_url| does not exist and
// its parent path is a file.
//
virtual void CopyInForeignFile(const base::FilePath& src_local_disk_path,
@@ -388,8 +386,8 @@ class FileSystemOperation {
// Removes a single file.
//
// This returns:
- // - PLATFORM_FILE_ERROR_NOT_FOUND if |url| does not exist.
- // - PLATFORM_FILE_ERROR_NOT_A_FILE if |url| is not a file.
+ // - File::FILE_ERROR_NOT_FOUND if |url| does not exist.
+ // - File::FILE_ERROR_NOT_A_FILE if |url| is not a file.
//
virtual void RemoveFile(const FileSystemURL& url,
const StatusCallback& callback) = 0;
@@ -397,9 +395,9 @@ class FileSystemOperation {
// Removes a single empty directory.
//
// This returns:
- // - PLATFORM_FILE_ERROR_NOT_FOUND if |url| does not exist.
- // - PLATFORM_FILE_ERROR_NOT_A_DIRECTORY if |url| is not a directory.
- // - PLATFORM_FILE_ERROR_NOT_EMPTY if |url| is not empty.
+ // - File::FILE_ERROR_NOT_FOUND if |url| does not exist.
+ // - File::FILE_ERROR_NOT_A_DIRECTORY if |url| is not a directory.
+ // - File::FILE_ERROR_NOT_EMPTY if |url| is not empty.
//
virtual void RemoveDirectory(const FileSystemURL& url,
const StatusCallback& callback) = 0;
@@ -414,12 +412,12 @@ class FileSystemOperation {
// optional.
//
// This returns:
- // - PLATFORM_FILE_ERROR_NOT_FOUND if |src_url|
+ // - File::FILE_ERROR_NOT_FOUND if |src_url|
// or the parent directory of |dest_url| does not exist.
- // - PLATFORM_FILE_ERROR_NOT_A_FILE if |src_url| exists but is not a file.
- // - PLATFORM_FILE_ERROR_INVALID_OPERATION if |dest_url| exists and
+ // - File::FILE_ERROR_NOT_A_FILE if |src_url| exists but is not a file.
+ // - File::FILE_ERROR_INVALID_OPERATION if |dest_url| exists and
// is not a file.
- // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and
+ // - File::FILE_ERROR_FAILED if |dest_url| does not exist and
// its parent path is a file.
//
virtual void CopyFileLocal(const FileSystemURL& src_url,
@@ -435,12 +433,12 @@ class FileSystemOperation {
// comment for details.
//
// This returns:
- // - PLATFORM_FILE_ERROR_NOT_FOUND if |src_url|
+ // - File::FILE_ERROR_NOT_FOUND if |src_url|
// or the parent directory of |dest_url| does not exist.
- // - PLATFORM_FILE_ERROR_NOT_A_FILE if |src_url| exists but is not a file.
- // - PLATFORM_FILE_ERROR_INVALID_OPERATION if |dest_url| exists and
+ // - File::FILE_ERROR_NOT_A_FILE if |src_url| exists but is not a file.
+ // - File::FILE_ERROR_INVALID_OPERATION if |dest_url| exists and
// is not a file.
- // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and
+ // - File::FILE_ERROR_FAILED if |dest_url| does not exist and
// its parent path is a file.
//
virtual void MoveFileLocal(const FileSystemURL& src_url,
@@ -451,7 +449,7 @@ class FileSystemOperation {
// Synchronously gets the platform path for the given |url|.
// This may fail if the given |url|'s filesystem type is neither
// temporary nor persistent.
- // In such a case, base::PLATFORM_FILE_ERROR_INVALID_OPERATION will be
+ // In such a case, base::File::FILE_ERROR_INVALID_OPERATION will be
// returned.
virtual base::File::Error SyncGetPlatformPath(
const FileSystemURL& url,
diff --git a/webkit/browser/fileapi/file_system_operation_impl.cc b/webkit/browser/fileapi/file_system_operation_impl.cc
index c6b578b..0f6728c 100644
--- a/webkit/browser/fileapi/file_system_operation_impl.cc
+++ b/webkit/browser/fileapi/file_system_operation_impl.cc
@@ -203,9 +203,8 @@ void FileSystemOperationImpl::OpenFile(const FileSystemURL& url,
DCHECK(SetPendingOperationType(kOperationOpenFile));
if (file_flags &
- (base::PLATFORM_FILE_TEMPORARY | base::PLATFORM_FILE_HIDDEN)) {
- callback.Run(base::File::FILE_ERROR_FAILED,
- base::kInvalidPlatformFileValue,
+ (base::File::FLAG_TEMPORARY | base::File::FLAG_HIDDEN)) {
+ callback.Run(base::File(base::File::FILE_ERROR_FAILED),
base::Closure());
return;
}
@@ -214,8 +213,7 @@ void FileSystemOperationImpl::OpenFile(const FileSystemURL& url,
base::Bind(&FileSystemOperationImpl::DoOpenFile,
weak_factory_.GetWeakPtr(),
url, callback, file_flags),
- base::Bind(callback, base::File::FILE_ERROR_FAILED,
- base::kInvalidPlatformFileValue,
+ base::Bind(callback, Passed(base::File(base::File::FILE_ERROR_FAILED)),
base::Closure()));
}
@@ -547,17 +545,7 @@ void FileSystemOperationImpl::DidOpenFile(
const OpenFileCallback& callback,
base::File file,
const base::Closure& on_close_callback) {
- // TODO(rvargas): Remove PlatformFile from FileSystemOperation.
- base::File::Error error;
- base::PlatformFile platform_file;
- if (file.IsValid()) {
- error = base::File::FILE_OK;
- platform_file = file.TakePlatformFile();
- } else {
- error = file.error_details();
- platform_file = base::kInvalidPlatformFileValue;
- }
- callback.Run(error, platform_file, on_close_callback);
+ callback.Run(file.Pass(), on_close_callback);
}
bool FileSystemOperationImpl::SetPendingOperationType(OperationType type) {
diff --git a/webkit/browser/fileapi/file_system_operation_runner.cc b/webkit/browser/fileapi/file_system_operation_runner.cc
index 4674cf8..1d588a7 100644
--- a/webkit/browser/fileapi/file_system_operation_runner.cc
+++ b/webkit/browser/fileapi/file_system_operation_runner.cc
@@ -350,16 +350,15 @@ OperationID FileSystemOperationRunner::OpenFile(
BeginOperationScoper scope;
OperationHandle handle = BeginOperation(operation, scope.AsWeakPtr());
if (!operation) {
- DidOpenFile(handle, callback, error, base::kInvalidPlatformFileValue,
- base::Closure());
+ DidOpenFile(handle, callback, base::File(error), base::Closure());
return handle.id;
}
if (file_flags &
- (base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_OPEN_ALWAYS |
- base::PLATFORM_FILE_CREATE_ALWAYS | base::PLATFORM_FILE_OPEN_TRUNCATED |
- base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_WRITE |
- base::PLATFORM_FILE_DELETE_ON_CLOSE |
- base::PLATFORM_FILE_WRITE_ATTRIBUTES)) {
+ (base::File::FLAG_CREATE | base::File::FLAG_OPEN_ALWAYS |
+ base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_OPEN_TRUNCATED |
+ base::File::FLAG_WRITE | base::File::FLAG_EXCLUSIVE_WRITE |
+ base::File::FLAG_DELETE_ON_CLOSE |
+ base::File::FLAG_WRITE_ATTRIBUTES)) {
PrepareForWrite(handle.id, url);
} else {
PrepareForRead(handle.id, url);
@@ -579,18 +578,17 @@ void FileSystemOperationRunner::DidWrite(
void FileSystemOperationRunner::DidOpenFile(
const OperationHandle& handle,
const OpenFileCallback& callback,
- base::File::Error rv,
- base::PlatformFile file,
+ base::File file,
const base::Closure& on_close_callback) {
if (handle.scope) {
finished_operations_.insert(handle.id);
base::MessageLoopProxy::current()->PostTask(
FROM_HERE, base::Bind(&FileSystemOperationRunner::DidOpenFile,
- AsWeakPtr(), handle, callback, rv, file,
+ AsWeakPtr(), handle, callback, Passed(&file),
on_close_callback));
return;
}
- callback.Run(rv, file, on_close_callback);
+ callback.Run(file.Pass(), on_close_callback);
FinishOperation(handle.id);
}
diff --git a/webkit/browser/fileapi/file_system_operation_runner.h b/webkit/browser/fileapi/file_system_operation_runner.h
index 1a5314c..555fe3b 100644
--- a/webkit/browser/fileapi/file_system_operation_runner.h
+++ b/webkit/browser/fileapi/file_system_operation_runner.h
@@ -271,8 +271,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner
void DidOpenFile(
const OperationHandle& handle,
const OpenFileCallback& callback,
- base::File::Error rv,
- base::PlatformFile file,
+ base::File file,
const base::Closure& on_close_callback);
void DidCreateSnapshot(
const OperationHandle& handle,
diff --git a/webkit/browser/fileapi/obfuscated_file_util.cc b/webkit/browser/fileapi/obfuscated_file_util.cc
index 450ea18..73722d4 100644
--- a/webkit/browser/fileapi/obfuscated_file_util.cc
+++ b/webkit/browser/fileapi/obfuscated_file_util.cc
@@ -275,7 +275,7 @@ base::File ObfuscatedFileUtil::CreateOrOpen(
FileSystemOperationContext* context,
const FileSystemURL& url, int file_flags) {
base::File file = CreateOrOpenInternal(context, url, file_flags);
- if (file.IsValid() && file_flags & base::PLATFORM_FILE_WRITE &&
+ if (file.IsValid() && file_flags & base::File::FLAG_WRITE &&
context->quota_limit_type() == quota::kQuotaLimitTypeUnlimited &&
sandbox_delegate_) {
sandbox_delegate_->StickyInvalidateUsageCache(url.origin(), url.type());