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

Unified Diff: webkit/browser/fileapi/local_file_system_operation.h

Issue 16413007: Make FileSystemOperation NOT self-destruct (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix browser_tests Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: webkit/browser/fileapi/local_file_system_operation.h
diff --git a/webkit/browser/fileapi/local_file_system_operation.h b/webkit/browser/fileapi/local_file_system_operation.h
index 35ab32b6806207a8c148b7732bfc8114a692fc35..afb96b36ca8e5edd35adad9df2758d4878ef4790 100644
--- a/webkit/browser/fileapi/local_file_system_operation.h
+++ b/webkit/browser/fileapi/local_file_system_operation.h
@@ -9,7 +9,9 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "webkit/browser/fileapi/file_system_operation.h"
+#include "webkit/browser/fileapi/file_system_operation_context.h"
#include "webkit/browser/fileapi/file_system_url.h"
#include "webkit/browser/fileapi/file_writer_delegate.h"
#include "webkit/common/blob/scoped_file.h"
@@ -32,7 +34,8 @@ class RecursiveOperationDelegate;
// FileSystemOperation implementation for local file systems.
class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation
- : public NON_EXPORTED_BASE(FileSystemOperation) {
+ : public NON_EXPORTED_BASE(FileSystemOperation),
+ public base::SupportsWeakPtr<LocalFileSystemOperation> {
public:
// NOTE: This constructor should not be called outside MountPointProviders;
// instead please consider using
@@ -165,10 +168,6 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation
return file_system_context_.get();
}
- FileSystemOperationContext* operation_context() const {
- return operation_context_.get();
- }
-
private:
friend class sync_file_system::SyncableFileSystemOperation;
@@ -233,14 +232,8 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation
base::PlatformFileError rv,
bool created);
- // Generic callback that translates platform errors to WebKit error codes.
- void DidFinishFileOperation(const StatusCallback& callback,
- base::PlatformFileError rv);
-
- // Generic callback when we delegated the operation.
- void DidFinishDelegatedOperation(const StatusCallback& callback,
- base::PlatformFileError rv);
-
+ void DidFinishOperation(const StatusCallback& callback,
+ base::PlatformFileError rv);
void DidDirectoryExists(const StatusCallback& callback,
base::PlatformFileError rv,
const base::PlatformFileInfo& file_info,
@@ -249,30 +242,15 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation
base::PlatformFileError rv,
const base::PlatformFileInfo& file_info,
const base::FilePath& unused);
- void DidGetMetadata(const GetMetadataCallback& callback,
- base::PlatformFileError rv,
- const base::PlatformFileInfo& file_info,
- const base::FilePath& platform_path);
- void DidReadDirectory(const ReadDirectoryCallback& callback,
- base::PlatformFileError rv,
- const std::vector<DirectoryEntry>& entries,
- bool has_more);
void DidWrite(const FileSystemURL& url,
+ const WriteCallback& callback,
base::PlatformFileError rv,
int64 bytes,
FileWriterDelegate::WriteProgressStatus write_status);
- void DidTouchFile(const StatusCallback& callback,
- base::PlatformFileError rv);
void DidOpenFile(const OpenFileCallback& callback,
base::PlatformFileError rv,
base::PassPlatformFile file,
bool created);
- void DidCreateSnapshotFile(
- const SnapshotFileCallback& callback,
- base::PlatformFileError result,
- const base::PlatformFileInfo& file_info,
- const base::FilePath& platform_path,
- const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref);
// Used only for internal assertions.
// Returns false if there's another inflight pending operation.
@@ -283,17 +261,9 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation
scoped_ptr<FileSystemOperationContext> operation_context_;
AsyncFileUtil* async_file_util_; // Not owned.
- // These are all used only by Write().
- friend class FileWriterDelegate;
scoped_ptr<FileWriterDelegate> file_writer_delegate_;
-
scoped_ptr<RecursiveOperationDelegate> recursive_operation_delegate_;
- // write_callback is kept in this class for so that we can dispatch it when
- // the operation is cancelled. calcel_callback is kept for canceling a
- // Truncate() operation. We can't actually stop Truncate in another thread;
- // after it resumed from the working thread, cancellation takes place.
- WriteCallback write_callback_;
StatusCallback cancel_callback_;
// Used only by OpenFile, in order to clone the file handle back to the
@@ -303,10 +273,6 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation
// A flag to make sure we call operation only once per instance.
OperationType pending_operation_;
- // LocalFileSystemOperation instance is usually deleted upon completion but
- // could be deleted while it has inflight callbacks when Cancel is called.
- base::WeakPtrFactory<LocalFileSystemOperation> weak_factory_;
-
DISALLOW_COPY_AND_ASSIGN(LocalFileSystemOperation);
};
« no previous file with comments | « webkit/browser/fileapi/file_writer_delegate.cc ('k') | webkit/browser/fileapi/local_file_system_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698