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

Unified Diff: webkit/fileapi/local_file_system_operation.h

Issue 12036022: Split recursive Copy/Move into async tasks and support cross operation (in local case) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 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_file_util_proxy.cc ('k') | webkit/fileapi/local_file_system_operation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/local_file_system_operation.h
diff --git a/webkit/fileapi/local_file_system_operation.h b/webkit/fileapi/local_file_system_operation.h
index fafaca642fad18fb96990217e373d252c2ab1592..d5f33d85940299124a5b07522dbce8de64113808 100644
--- a/webkit/fileapi/local_file_system_operation.h
+++ b/webkit/fileapi/local_file_system_operation.h
@@ -25,7 +25,7 @@ class CrosMountPointProvider;
namespace fileapi {
class FileSystemContext;
-class RemoveOperationDelegate;
+class RecursiveOperationDelegate;
// FileSystemOperation implementation for local file systems.
class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation
@@ -112,6 +112,40 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation
void RemoveDirectory(const FileSystemURL& url,
const StatusCallback& callback);
+ // Copies a file from |src_url| to |dest_url|.
+ // This must be called for files that belong to the same filesystem
+ // (i.e. type() and origin() of the |src_url| and |dest_url| must match).
+ //
+ // This returns:
+ // - PLATFORM_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
+ // is not a file.
+ // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and
+ // its parent path is a file.
+ //
+ void CopyFileLocal(const FileSystemURL& src_url,
+ const FileSystemURL& dest_url,
+ const StatusCallback& callback);
+
+ // Moves a local file from |src_url| to |dest_url|.
+ // This must be called for files that belong to the same filesystem
+ // (i.e. type() and origin() of the |src_url| and |dest_url| must match).
+ //
+ // This returns:
+ // - PLATFORM_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
+ // is not a file.
+ // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and
+ // its parent path is a file.
+ //
+ void MoveFileLocal(const FileSystemURL& src_url,
+ const FileSystemURL& dest_url,
+ const StatusCallback& callback);
+
// Synchronously gets the platform path for the given |url|.
void SyncGetPlatformPath(const FileSystemURL& url, FilePath* platform_path);
@@ -138,7 +172,8 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation
friend class FileSystemQuotaTest;
friend class LocalFileSystemTestOriginHelper;
- friend class RemoveOperationDelegate;
+ friend class RecursiveOperationDelegate;
+ friend class CrossOperationDelegate;
friend class SyncableFileSystemOperation;
LocalFileSystemOperation(
@@ -192,15 +227,15 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation
const StatusCallback& callback,
bool exclusive,
bool recursive);
- void DoCopy(const FileSystemURL& src,
- const FileSystemURL& dest,
- const StatusCallback& callback);
+ void DoCopyFileLocal(const FileSystemURL& src,
+ const FileSystemURL& dest,
+ const StatusCallback& callback);
+ void DoMoveFileLocal(const FileSystemURL& src,
+ const FileSystemURL& dest,
+ const StatusCallback& callback);
void DoCopyInForeignFile(const FilePath& src_local_disk_file_path,
const FileSystemURL& dest,
const StatusCallback& callback);
- void DoMove(const FileSystemURL& src,
- const FileSystemURL& dest,
- const StatusCallback& callback);
void DoTruncate(const FileSystemURL& url,
const StatusCallback& callback, int64 length);
void DoOpenFile(const FileSystemURL& url,
@@ -286,18 +321,13 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation
scoped_refptr<FileSystemContext> file_system_context_;
scoped_ptr<FileSystemOperationContext> operation_context_;
- FileSystemFileUtil* src_util_; // Not owned.
- FileSystemFileUtil* dest_util_; // Not owned.
+ FileSystemFileUtil* file_util_; // Not owned.
FileSystemOperationContext* overriding_operation_context_;
// A callback that is called when this instance goes away.
base::Closure termination_callback_;
- // Indicates if this operation is for cross filesystem operation or not.
- // TODO(kinuko): This should be cleaned up.
- bool is_cross_operation_;
-
// This is set before any write operations to dispatch
// FileUpdateObserver::StartUpdate and FileUpdateObserver::EndUpdate.
ScopedVector<ScopedUpdateNotifier> scoped_update_notifiers_;
@@ -306,7 +336,7 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation
friend class FileWriterDelegate;
scoped_ptr<FileWriterDelegate> file_writer_delegate_;
- scoped_ptr<RemoveOperationDelegate> remove_operation_delegate_;
+ scoped_ptr<RecursiveOperationDelegate> recursive_operation_delegate_;
// write_callback is kept in this class for so that we can dispatch it when
// the operation is cancelled. calcel_callback is kept for canceling a
« no previous file with comments | « webkit/fileapi/file_system_file_util_proxy.cc ('k') | webkit/fileapi/local_file_system_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698