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

Side by Side Diff: webkit/fileapi/file_system_file_util_proxy.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, 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/fileapi/file_system_file_util.h ('k') | webkit/fileapi/file_system_file_util_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/files/file_util_proxy.h" 10 #include "base/files/file_util_proxy.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 // Creates or opens a file with the given flags by calling |file_util|'s 58 // Creates or opens a file with the given flags by calling |file_util|'s
59 // CreateOrOpen method on the given context's task_runner. 59 // CreateOrOpen method on the given context's task_runner.
60 static bool CreateOrOpen( 60 static bool CreateOrOpen(
61 FileSystemOperationContext* context, 61 FileSystemOperationContext* context,
62 FileSystemFileUtil* file_util, 62 FileSystemFileUtil* file_util,
63 const FileSystemURL& url, 63 const FileSystemURL& url,
64 int file_flags, 64 int file_flags,
65 const CreateOrOpenCallback& callback); 65 const CreateOrOpenCallback& callback);
66 66
67 // Copies a file or a directory from |src_url| to |dest_url| by calling 67 // Copies a local file or a directory from |src_url| to |dest_url|.
68 // FileSystemFileUtil's following methods on the given context's 68 static bool CopyFileLocal(
69 // task_runner.
70 // - CopyOrMoveFile() for same-filesystem operations
71 // - CopyInForeignFile() for (limited) cross-filesystem operations
72 //
73 // Error cases:
74 // If destination's parent doesn't exist.
75 // If source dir exists but destination url is an existing file.
76 // If source file exists but destination url is an existing directory.
77 // If source is a parent of destination.
78 // If source doesn't exist.
79 // If source and dest are the same url in the same filesystem.
80 static bool Copy(
81 FileSystemOperationContext* context, 69 FileSystemOperationContext* context,
82 FileSystemFileUtil* src_util, 70 FileSystemFileUtil* file_util,
83 FileSystemFileUtil* dest_util, 71 const FileSystemURL& src_url,
72 const FileSystemURL& dest_url,
73 const StatusCallback& callback);
74
75 // Moves a local file or a directory from |src_url| to |dest_url|.
76 static bool MoveFileLocal(
77 FileSystemOperationContext* context,
78 FileSystemFileUtil* file_util,
84 const FileSystemURL& src_url, 79 const FileSystemURL& src_url,
85 const FileSystemURL& dest_url, 80 const FileSystemURL& dest_url,
86 const StatusCallback& callback); 81 const StatusCallback& callback);
87 82
88 // Copies a file from local disk to the given filesystem destination. 83 // Copies a file from local disk to the given filesystem destination.
89 // Primarily used for the Syncable filesystem type (e.g. GDrive). 84 // Primarily used for the Syncable filesystem type (e.g. GDrive).
90 static bool CopyInForeignFile( 85 static bool CopyInForeignFile(
91 FileSystemOperationContext* context, 86 FileSystemOperationContext* context,
92 FileSystemFileUtil* dest_util, 87 FileSystemFileUtil* file_util,
93 const FilePath& src_local_disk_file_path, 88 const FilePath& src_local_disk_file_path,
94 const FileSystemURL& dest_url, 89 const FileSystemURL& dest_url,
95 const StatusCallback& callback); 90 const StatusCallback& callback);
96 91
97 // Moves a file or a directory from |src_url| to |dest_url| by calling
98 // FileSystemFileUtil's following methods on the given context's
99 // task_runner.
100 // - CopyOrMoveFile() for same-filesystem operations
101 // - CopyInForeignFile() for (limited) cross-filesystem operations
102 //
103 // This method returns an error on the same error cases with Copy.
104 static bool Move(
105 FileSystemOperationContext* context,
106 FileSystemFileUtil* src_util,
107 FileSystemFileUtil* dest_util,
108 const FileSystemURL& src_url,
109 const FileSystemURL& dest_url,
110 const StatusCallback& callback);
111
112 // Ensures that the given |url| exist by calling |file_util|'s 92 // Ensures that the given |url| exist by calling |file_util|'s
113 // EnsureFileExists method on the given context's task_runner. 93 // EnsureFileExists method on the given context's task_runner.
114 static bool EnsureFileExists( 94 static bool EnsureFileExists(
115 FileSystemOperationContext* context, 95 FileSystemOperationContext* context,
116 FileSystemFileUtil* file_util, 96 FileSystemFileUtil* file_util,
117 const FileSystemURL& url, 97 const FileSystemURL& url,
118 const EnsureFileExistsCallback& callback); 98 const EnsureFileExistsCallback& callback);
119 99
120 // Creates directory at a given url by calling |file_util|'s 100 // Creates directory at a given url by calling |file_util|'s
121 // CreateDirectory method on the given context's task_runner. 101 // CreateDirectory method on the given context's task_runner.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 int64 length, 152 int64 length,
173 const StatusCallback& callback); 153 const StatusCallback& callback);
174 154
175 private: 155 private:
176 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemFileUtilProxy); 156 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemFileUtilProxy);
177 }; 157 };
178 158
179 } // namespace fileapi 159 } // namespace fileapi
180 160
181 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_ 161 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_PROXY_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_file_util.h ('k') | webkit/fileapi/file_system_file_util_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698