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

Side by Side Diff: webkit/fileapi/file_system_file_util.h

Issue 12051010: (For-try) Divide recursive Copy/Move into multiple async tasks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test fix 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 unified diff | Download patch | Annotate | Revision Log
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_H_ 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
7 7
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 const base::Time& last_access_time, 148 const base::Time& last_access_time,
149 const base::Time& last_modified_time) = 0; 149 const base::Time& last_modified_time) = 0;
150 150
151 // Truncates a file to the given length. If |length| is greater than the 151 // Truncates a file to the given length. If |length| is greater than the
152 // current length of the file, the file will be extended with zeroes. 152 // current length of the file, the file will be extended with zeroes.
153 virtual base::PlatformFileError Truncate( 153 virtual base::PlatformFileError Truncate(
154 FileSystemOperationContext* context, 154 FileSystemOperationContext* context,
155 const FileSystemURL& url, 155 const FileSystemURL& url,
156 int64 length) = 0; 156 int64 length) = 0;
157 157
158 // Returns true if a given |url| is an empty directory.
159 virtual bool IsDirectoryEmpty(
160 FileSystemOperationContext* context,
161 const FileSystemURL& url) = 0;
162
163 // Copies or moves a single file from |src_url| to |dest_url|. 158 // Copies or moves a single file from |src_url| to |dest_url|.
159 // The filesystem type of |src_url| and |dest_url| MUST be same.
160 //
161 // This returns:
162 // - PLATFORM_FILE_ERROR_NOT_FOUND if |src_url|
163 // or the parent directory of |dest_url| does not exist.
164 // - PLATFORM_FILE_ERROR_NOT_A_FILE if |src_url| exists but is not a file.
165 // - PLATFORM_FILE_ERROR_INVALID_OPERATION if |dest_url| exists and
166 // is not a file.
167 // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and
168 // its parent path is a file.
169 //
164 virtual base::PlatformFileError CopyOrMoveFile( 170 virtual base::PlatformFileError CopyOrMoveFile(
165 FileSystemOperationContext* context, 171 FileSystemOperationContext* context,
166 const FileSystemURL& src_url, 172 const FileSystemURL& src_url,
167 const FileSystemURL& dest_url, 173 const FileSystemURL& dest_url,
168 bool copy) = 0; 174 bool copy) = 0;
169 175
170 // Copies in a single file from a different filesystem. 176 // Copies in a single file from a different filesystem.
177 //
178 // This returns:
179 // - PLATFORM_FILE_ERROR_NOT_FOUND if |src_file_path|
180 // or the parent directory of |dest_url| does not exist.
181 // - PLATFORM_FILE_ERROR_INVALID_OPERATION if |dest_url| exists and
182 // is not a file.
183 // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and
184 // its parent path is a file.
185 //
171 virtual base::PlatformFileError CopyInForeignFile( 186 virtual base::PlatformFileError CopyInForeignFile(
172 FileSystemOperationContext* context, 187 FileSystemOperationContext* context,
173 const FilePath& src_file_path, 188 const FilePath& src_file_path,
174 const FileSystemURL& dest_url) = 0; 189 const FileSystemURL& dest_url) = 0;
175 190
176 // Deletes a single file. 191 // Deletes a single file.
177 // It assumes the given url points a file. 192 //
193 // This returns:
194 // - PLATFORM_FILE_ERROR_NOT_FOUND if |url| does not exist.
195 // - PLATFORM_FILE_ERROR_NOT_A_FILE if |url| is not a file.
196 //
178 virtual base::PlatformFileError DeleteFile( 197 virtual base::PlatformFileError DeleteFile(
179 FileSystemOperationContext* context, 198 FileSystemOperationContext* context,
180 const FileSystemURL& url) = 0; 199 const FileSystemURL& url) = 0;
181 200
182 // Deletes a single empty directory. 201 // Deletes a single empty directory.
183 // It assumes the given url points an empty directory. 202 //
184 virtual base::PlatformFileError DeleteSingleDirectory( 203 // This returns:
204 // - PLATFORM_FILE_ERROR_NOT_FOUND if |url| does not exist.
205 // - PLATFORM_FILE_ERROR_NOT_A_DIRECTORY if |url| is not a directory.
206 // - PLATFORM_FILE_ERROR_NOT_EMPTY if |url| is not empty.
207 //
208 virtual base::PlatformFileError DeleteDirectory(
185 FileSystemOperationContext* context, 209 FileSystemOperationContext* context,
186 const FileSystemURL& url) = 0; 210 const FileSystemURL& url) = 0;
187 211
188 // Creates a local snapshot file for a given |url| and returns the 212 // Creates a local snapshot file for a given |url| and returns the
189 // metadata and platform path of the snapshot file via |callback|. 213 // metadata and platform path of the snapshot file via |callback|.
190 // In regular filesystem cases the implementation may simply return 214 // In regular filesystem cases the implementation may simply return
191 // the metadata of the file itself (as well as GetMetadata does), 215 // the metadata of the file itself (as well as GetMetadata does),
192 // while in non-regular filesystem case the backend may create a 216 // while in non-regular filesystem case the backend may create a
193 // temporary snapshot file which holds the file data and return 217 // temporary snapshot file which holds the file data and return
194 // the metadata of the temporary file. 218 // the metadata of the temporary file.
195 // 219 //
196 // |file_info| is the metadata of the snapshot file created. 220 // |file_info| is the metadata of the snapshot file created.
197 // |platform_path| is the path to the snapshot file created. 221 // |platform_path| is the path to the snapshot file created.
198 // |policy| should indicate the policy how the fileapi backend 222 // |policy| should indicate the policy how the fileapi backend
199 // should handle the returned file. 223 // should handle the returned file.
224 //
225 // This returns:
226 // - PLATFORM_FILE_ERROR_NOT_FOUND if |url| does not exist.
227 // - PLATFORM_FILE_ERROR_NOT_A_FILE if |url| is not a file.
228 //
200 virtual base::PlatformFileError CreateSnapshotFile( 229 virtual base::PlatformFileError CreateSnapshotFile(
201 FileSystemOperationContext* context, 230 FileSystemOperationContext* context,
202 const FileSystemURL& url, 231 const FileSystemURL& url,
203 base::PlatformFileInfo* file_info, 232 base::PlatformFileInfo* file_info,
204 FilePath* platform_path, 233 FilePath* platform_path,
205 SnapshotFilePolicy* policy) = 0; 234 SnapshotFilePolicy* policy) = 0;
206 235
207 protected: 236 protected:
208 FileSystemFileUtil() {} 237 FileSystemFileUtil() {}
209 238
210 private: 239 private:
211 DISALLOW_COPY_AND_ASSIGN(FileSystemFileUtil); 240 DISALLOW_COPY_AND_ASSIGN(FileSystemFileUtil);
212 }; 241 };
213 242
214 } // namespace fileapi 243 } // namespace fileapi
215 244
216 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ 245 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698