| OLD | NEW |
| 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_OPERATION_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 int64 usage, int64 quota); | 168 int64 usage, int64 quota); |
| 169 | 169 |
| 170 // The 'body' methods that perform the actual work (i.e. posting the | 170 // The 'body' methods that perform the actual work (i.e. posting the |
| 171 // file task on proxy_) after the quota check. | 171 // file task on proxy_) after the quota check. |
| 172 void DoCreateFile(const StatusCallback& callback, bool exclusive); | 172 void DoCreateFile(const StatusCallback& callback, bool exclusive); |
| 173 void DoCreateDirectory(const StatusCallback& callback, | 173 void DoCreateDirectory(const StatusCallback& callback, |
| 174 bool exclusive, | 174 bool exclusive, |
| 175 bool recursive); | 175 bool recursive); |
| 176 void DoCopy(const StatusCallback& callback); | 176 void DoCopy(const StatusCallback& callback); |
| 177 void DoMove(const StatusCallback& callback); | 177 void DoMove(const StatusCallback& callback); |
| 178 void DoWrite(); | 178 void DoWrite(const GURL& blob_url, |
| 179 const net::URLRequestContext* request_context); |
| 179 void DoTruncate(const StatusCallback& callback, int64 length); | 180 void DoTruncate(const StatusCallback& callback, int64 length); |
| 180 void DoOpenFile(const OpenFileCallback& callback, int file_flags); | 181 void DoOpenFile(const OpenFileCallback& callback, int file_flags); |
| 181 | 182 |
| 182 // Callback for CreateFile for |exclusive|=true cases. | 183 // Callback for CreateFile for |exclusive|=true cases. |
| 183 void DidEnsureFileExistsExclusive(const StatusCallback& callback, | 184 void DidEnsureFileExistsExclusive(const StatusCallback& callback, |
| 184 base::PlatformFileError rv, | 185 base::PlatformFileError rv, |
| 185 bool created); | 186 bool created); |
| 186 | 187 |
| 187 // Callback for CreateFile for |exclusive|=false cases. | 188 // Callback for CreateFile for |exclusive|=false cases. |
| 188 void DidEnsureFileExistsNonExclusive(const StatusCallback& callback, | 189 void DidEnsureFileExistsNonExclusive(const StatusCallback& callback, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 213 int64 bytes, | 214 int64 bytes, |
| 214 bool complete); | 215 bool complete); |
| 215 void DidTouchFile(const StatusCallback& callback, | 216 void DidTouchFile(const StatusCallback& callback, |
| 216 base::PlatformFileError rv); | 217 base::PlatformFileError rv); |
| 217 void DidOpenFile(const OpenFileCallback& callback, | 218 void DidOpenFile(const OpenFileCallback& callback, |
| 218 base::PlatformFileError rv, | 219 base::PlatformFileError rv, |
| 219 base::PassPlatformFile file, | 220 base::PassPlatformFile file, |
| 220 bool created); | 221 bool created); |
| 221 | 222 |
| 222 // Helper for Write(). | 223 // Helper for Write(). |
| 223 void OnFileOpenedForWrite(base::PlatformFileError rv, | 224 void OnFileOpenedForWrite(const GURL& blob_url, |
| 225 const net::URLRequestContext* request_context, |
| 226 base::PlatformFileError rv, |
| 224 base::PassPlatformFile file, | 227 base::PassPlatformFile file, |
| 225 bool created); | 228 bool created); |
| 226 | 229 |
| 227 // Checks the validity of a given |path_url| and and populates | 230 // Checks the validity of a given |path_url| and and populates |
| 228 // |path| and |file_util| for |mode|. | 231 // |path| and |file_util| for |mode|. |
| 229 base::PlatformFileError SetUpFileSystemPath( | 232 base::PlatformFileError SetUpFileSystemPath( |
| 230 const GURL& path_url, | 233 const GURL& path_url, |
| 231 FileSystemPath* file_system_path, | 234 FileSystemPath* file_system_path, |
| 232 FileSystemFileUtil** file_util, | 235 FileSystemFileUtil** file_util, |
| 233 SetUpPathMode mode); | 236 SetUpPathMode mode); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 247 | 250 |
| 248 // This is set before any write operations. The destructor of | 251 // This is set before any write operations. The destructor of |
| 249 // ScopedQuotaNotifier sends notification to the QuotaManager | 252 // ScopedQuotaNotifier sends notification to the QuotaManager |
| 250 // to tell the update is done; so that we can make sure notify | 253 // to tell the update is done; so that we can make sure notify |
| 251 // the manager after any write operations are done. | 254 // the manager after any write operations are done. |
| 252 scoped_ptr<ScopedQuotaNotifier> scoped_quota_notifier_; | 255 scoped_ptr<ScopedQuotaNotifier> scoped_quota_notifier_; |
| 253 | 256 |
| 254 // These are all used only by Write(). | 257 // These are all used only by Write(). |
| 255 friend class FileWriterDelegate; | 258 friend class FileWriterDelegate; |
| 256 scoped_ptr<FileWriterDelegate> file_writer_delegate_; | 259 scoped_ptr<FileWriterDelegate> file_writer_delegate_; |
| 257 scoped_ptr<net::URLRequest> blob_request_; | |
| 258 | 260 |
| 259 // write_callback is kept in this class for so that we can dispatch it when | 261 // write_callback is kept in this class for so that we can dispatch it when |
| 260 // the operation is cancelled. calcel_callback is kept for canceling a | 262 // the operation is cancelled. calcel_callback is kept for canceling a |
| 261 // Truncate() operation. We can't actually stop Truncate in another thread; | 263 // Truncate() operation. We can't actually stop Truncate in another thread; |
| 262 // after it resumed from the working thread, cancellation takes place. | 264 // after it resumed from the working thread, cancellation takes place. |
| 263 WriteCallback write_callback_; | 265 WriteCallback write_callback_; |
| 264 StatusCallback cancel_callback_; | 266 StatusCallback cancel_callback_; |
| 265 void set_write_callback(const WriteCallback& write_callback) { | 267 void set_write_callback(const WriteCallback& write_callback) { |
| 266 write_callback_ = write_callback; | 268 write_callback_ = write_callback; |
| 267 } | 269 } |
| 268 | 270 |
| 269 // Used only by OpenFile, in order to clone the file handle back to the | 271 // Used only by OpenFile, in order to clone the file handle back to the |
| 270 // requesting process. | 272 // requesting process. |
| 271 base::ProcessHandle peer_handle_; | 273 base::ProcessHandle peer_handle_; |
| 272 | 274 |
| 273 // A flag to make sure we call operation only once per instance. | 275 // A flag to make sure we call operation only once per instance. |
| 274 OperationType pending_operation_; | 276 OperationType pending_operation_; |
| 275 | 277 |
| 276 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); | 278 DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); |
| 277 }; | 279 }; |
| 278 | 280 |
| 279 } // namespace fileapi | 281 } // namespace fileapi |
| 280 | 282 |
| 281 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ | 283 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_OPERATION_H_ |
| OLD | NEW |