Index: webkit/fileapi/file_system_file_util_proxy.cc |
diff --git a/webkit/fileapi/file_system_file_util_proxy.cc b/webkit/fileapi/file_system_file_util_proxy.cc |
index a26bb390a389e85d8800630bfb89cb73c343eacd..9682a0b829bfd3885e43fe50d7654f773ac3c2f0 100644 |
--- a/webkit/fileapi/file_system_file_util_proxy.cc |
+++ b/webkit/fileapi/file_system_file_util_proxy.cc |
@@ -23,28 +23,6 @@ namespace { |
typedef fileapi::FileSystemFileUtilProxy Proxy; |
-class CopyOrMoveHelper { |
- public: |
- CopyOrMoveHelper(CrossFileUtilHelper* helper) |
- : helper_(helper), |
- error_(base::PLATFORM_FILE_OK) {} |
- ~CopyOrMoveHelper() {} |
- |
- void RunWork() { |
- error_ = helper_->DoWork(); |
- } |
- |
- void Reply(const Proxy::StatusCallback& callback) { |
- if (!callback.is_null()) |
- callback.Run(error_); |
- } |
- |
- private: |
- scoped_ptr<CrossFileUtilHelper> helper_; |
- base::PlatformFileError error_; |
- DISALLOW_COPY_AND_ASSIGN(CopyOrMoveHelper); |
-}; |
- |
class EnsureFileExistsHelper { |
public: |
EnsureFileExistsHelper() : error_(base::PLATFORM_FILE_OK), created_(false) {} |
@@ -153,14 +131,15 @@ bool FileSystemFileUtilProxy::Copy( |
const FileSystemPath& src_path, |
const FileSystemPath& dest_path, |
const StatusCallback& callback) { |
- CopyOrMoveHelper* helper = new CopyOrMoveHelper( |
+ CrossFileUtilHelper* helper = |
new CrossFileUtilHelper( |
context, src_util, dest_util, src_path, dest_path, |
- CrossFileUtilHelper::OPERATION_COPY)); |
- return message_loop_proxy->PostTaskAndReply( |
- FROM_HERE, |
- Bind(&CopyOrMoveHelper::RunWork, Unretained(helper)), |
- Bind(&CopyOrMoveHelper::Reply, Owned(helper), callback)); |
+ CrossFileUtilHelper::OPERATION_COPY); |
+ |
+ return base::FileUtilProxy::RelayFileTask( |
+ message_loop_proxy, FROM_HERE, |
+ Bind(&CrossFileUtilHelper::DoWork, Owned(helper)), |
+ callback); |
} |
// static |
@@ -172,14 +151,14 @@ bool FileSystemFileUtilProxy::Move( |
const FileSystemPath& src_path, |
const FileSystemPath& dest_path, |
const StatusCallback& callback) { |
- CopyOrMoveHelper* helper = new CopyOrMoveHelper( |
+ CrossFileUtilHelper* helper = |
new CrossFileUtilHelper( |
context, src_util, dest_util, src_path, dest_path, |
- CrossFileUtilHelper::OPERATION_MOVE)); |
- return message_loop_proxy->PostTaskAndReply( |
- FROM_HERE, |
- Bind(&CopyOrMoveHelper::RunWork, Unretained(helper)), |
- Bind(&CopyOrMoveHelper::Reply, Owned(helper), callback)); |
+ CrossFileUtilHelper::OPERATION_MOVE); |
+ return base::FileUtilProxy::RelayFileTask( |
+ message_loop_proxy, FROM_HERE, |
+ Bind(&CrossFileUtilHelper::DoWork, Owned(helper)), |
+ callback); |
} |
// static |