diff options
author | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-05 01:24:51 +0000 |
---|---|---|
committer | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-05 01:24:51 +0000 |
commit | 43fad839433bfa7561f86e0f4629f5a9b2b31b3e (patch) | |
tree | 4596d8a7f4bb5e39c927d1cb8fde338779c3401f /webkit/fileapi/file_system_operation.h | |
parent | 23e2619fc7d0a817dd2f44a704b23cbac97c79da (diff) | |
download | chromium_src-43fad839433bfa7561f86e0f4629f5a9b2b31b3e.zip chromium_src-43fad839433bfa7561f86e0f4629f5a9b2b31b3e.tar.gz chromium_src-43fad839433bfa7561f86e0f4629f5a9b2b31b3e.tar.bz2 |
Add truncate and cancel for FileWriter; write and more tests will come in later CLs.
This CL also contains a fair amount of plumbing for the write call itself.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3599011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61462 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_operation.h')
-rw-r--r-- | webkit/fileapi/file_system_operation.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/webkit/fileapi/file_system_operation.h b/webkit/fileapi/file_system_operation.h index 1107303..ab6d56c 100644 --- a/webkit/fileapi/file_system_operation.h +++ b/webkit/fileapi/file_system_operation.h @@ -61,8 +61,7 @@ class FileSystemOperation { 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 @@ class FileSystemOperation { 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 @@ class FileSystemOperation { 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); |