summaryrefslogtreecommitdiffstats
path: root/base/file_util_proxy.cc
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-08 12:47:58 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-08 12:47:58 +0000
commitf3bed0141f547f49d05ea8973b88cf3511f48dcd (patch)
tree8c84089dc3abfedb8102b1f6eda60faabcf755d2 /base/file_util_proxy.cc
parentf6779a644fd46a4574869610b8a7ac5a38dfc7c2 (diff)
downloadchromium_src-f3bed0141f547f49d05ea8973b88cf3511f48dcd.zip
chromium_src-f3bed0141f547f49d05ea8973b88cf3511f48dcd.tar.gz
chromium_src-f3bed0141f547f49d05ea8973b88cf3511f48dcd.tar.bz2
Revert 109010 - Merge FileUtilProxy and FileSystemFileUtilProxy using PostTaskAndReply: Delete/Touch/Truncate/Copy/Move
BUG=none TEST=test_shell_tests:FileSystem* Review URL: http://codereview.chromium.org/8424007 TBR=kinuko@chromium.org Review URL: http://codereview.chromium.org/8497012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109015 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_proxy.cc')
-rw-r--r--base/file_util_proxy.cc51
1 files changed, 19 insertions, 32 deletions
diff --git a/base/file_util_proxy.cc b/base/file_util_proxy.cc
index 9b51d34..4c79465 100644
--- a/base/file_util_proxy.cc
+++ b/base/file_util_proxy.cc
@@ -176,6 +176,19 @@ class CreateTemporaryHelper {
DISALLOW_COPY_AND_ASSIGN(CreateTemporaryHelper);
};
+PlatformFileError DeleteHelper(const FilePath& file_path, bool recursive) {
+ if (!file_util::PathExists(file_path)) {
+ return PLATFORM_FILE_ERROR_NOT_FOUND;
+ }
+ if (!file_util::Delete(file_path, recursive)) {
+ if (!recursive && !file_util::IsDirectoryEmpty(file_path)) {
+ return PLATFORM_FILE_ERROR_NOT_EMPTY;
+ }
+ return PLATFORM_FILE_ERROR_FAILED;
+ }
+ return PLATFORM_FILE_OK;
+}
+
class GetFileInfoHelper {
public:
GetFileInfoHelper()
@@ -284,19 +297,6 @@ PlatformFileError CloseAdapter(PlatformFile file_handle) {
return PLATFORM_FILE_OK;
}
-PlatformFileError DeleteAdapter(const FilePath& file_path, bool recursive) {
- if (!file_util::PathExists(file_path)) {
- return PLATFORM_FILE_ERROR_NOT_FOUND;
- }
- if (!file_util::Delete(file_path, recursive)) {
- if (!recursive && !file_util::IsDirectoryEmpty(file_path)) {
- return PLATFORM_FILE_ERROR_NOT_EMPTY;
- }
- return PLATFORM_FILE_ERROR_FAILED;
- }
- return PLATFORM_FILE_OK;
-}
-
} // namespace
// static
@@ -367,10 +367,10 @@ bool FileUtilProxy::Delete(scoped_refptr<MessageLoopProxy> message_loop_proxy,
const FilePath& file_path,
bool recursive,
const StatusCallback& callback) {
- return RelayFileTask(
+ return PostTaskAndReplyWithStatus<PlatformFileError>(
message_loop_proxy, FROM_HERE,
- Bind(&DeleteAdapter, file_path, recursive),
- callback);
+ Bind(&DeleteHelper, file_path, recursive), callback,
+ new PlatformFileError);
}
// static
@@ -378,10 +378,10 @@ bool FileUtilProxy::RecursiveDelete(
scoped_refptr<MessageLoopProxy> message_loop_proxy,
const FilePath& file_path,
const StatusCallback& callback) {
- return RelayFileTask(
+ return PostTaskAndReplyWithStatus<PlatformFileError>(
message_loop_proxy, FROM_HERE,
- Bind(&DeleteAdapter, file_path, true /* recursive */),
- callback);
+ Bind(&DeleteHelper, file_path, true /* recursive */), callback,
+ new PlatformFileError);
}
// static
@@ -472,19 +472,6 @@ bool FileUtilProxy::Flush(
}
// static
-bool FileUtilProxy::RelayFileTask(
- scoped_refptr<MessageLoopProxy> message_loop_proxy,
- const tracked_objects::Location& from_here,
- const FileTask& file_task,
- const StatusCallback& callback) {
- PlatformFileError* result = new PlatformFileError;
- return message_loop_proxy->PostTaskAndReply(
- from_here,
- ReturnAsParam(file_task, result),
- ReplyHelper(callback, Owned(result)));
-}
-
-// static
bool FileUtilProxy::RelayCreateOrOpen(
scoped_refptr<MessageLoopProxy> message_loop_proxy,
const CreateOrOpenTask& open_task,