Index: webkit/fileapi/file_system_operation.h |
=================================================================== |
--- webkit/fileapi/file_system_operation.h (revision 61078) |
+++ webkit/fileapi/file_system_operation.h (working copy) |
@@ -61,8 +61,7 @@ |
void Remove(const FilePath& path); |
- void Write( |
- const FilePath& path, const GURL& blob_url, int64 offset); |
+ void Write(const FilePath& path, const GURL& blob_url, int64 offset); |
void Truncate(const FilePath& path, int64 length); |
@@ -70,9 +69,10 @@ |
const base::Time& last_access_time, |
const base::Time& last_modified_time); |
- // Used to attempt to cancel the current operation. This currently does |
- // nothing for any operation other than Write(). |
- void Cancel(); |
+ // Try to cancel the current operation [we support cancelling write or |
+ // truncate only]. Report failure for the current operation, then tell the |
+ // passed-in operation to report success. |
+ void Cancel(FileSystemOperation* cancel_operation); |
protected: |
// Proxy for calling file_util_proxy methods. |
@@ -114,9 +114,28 @@ |
base::ScopedCallbackFactory<FileSystemOperation> callback_factory_; |
+ FileSystemOperation* cancel_operation_; |
+ |
#ifndef NDEBUG |
+ enum OperationType { |
+ kOperationNone, |
+ kOperationCreateFile, |
+ kOperationCreateDirectory, |
+ kOperationCopy, |
+ kOperationMove, |
+ kOperationDirectoryExists, |
+ kOperationFileExists, |
+ kOperationGetMetadata, |
+ kOperationReadDirectory, |
+ kOperationRemove, |
+ kOperationWrite, |
+ kOperationTruncate, |
+ kOperationTouchFile, |
+ kOperationCancel, |
+ }; |
+ |
// A flag to make sure we call operation only once per instance. |
- bool operation_pending_; |
+ OperationType pending_operation_; |
#endif |
DISALLOW_COPY_AND_ASSIGN(FileSystemOperation); |