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

Unified Diff: webkit/fileapi/file_system_file_util_proxy.cc

Issue 9570061: Use RelayFileTask instead of CopyOrMoveHelper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix style Created 8 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698