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

Unified Diff: webkit/browser/fileapi/async_file_util.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/async_file_util.h
diff --git a/webkit/browser/fileapi/async_file_util.h b/webkit/browser/fileapi/async_file_util.h
index 0b61194b20c6d4b28ad1528386c3a1e038ad35ff..847adcffbde61fa39c82409964599623f9c58be2 100644
--- a/webkit/browser/fileapi/async_file_util.h
+++ b/webkit/browser/fileapi/async_file_util.h
@@ -8,6 +8,7 @@
#include "base/basictypes.h"
#include "base/callback_forward.h"
#include "base/files/file_util_proxy.h"
+#include "base/memory/scoped_ptr.h"
#include "base/platform_file.h"
#include "webkit/common/fileapi/directory_entry.h"
#include "webkit/storage/webkit_storage_export.h"
@@ -32,6 +33,11 @@ class FileSystemURL;
// must implement this interface or a synchronous version of interface:
// FileSystemFileUtil.
//
+// As far as an instance of this class is owned by a MountPointProvider
+// (which is owned by FileSystemContext), it's guaranteed that this instance's
+// alive while FileSystemOperationContext given to each operation is kept
+// alive. (Note that this instance might be freed on different thread
+// from the thread it is created.)
class WEBKIT_STORAGE_EXPORT AsyncFileUtil {
public:
typedef base::Callback<
@@ -75,7 +81,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil {
// This returns false if it fails to post an async task.
//
virtual bool CreateOrOpen(
- FileSystemOperationContext* context,
+ scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
int file_flags,
const CreateOrOpenCallback& callback) = 0;
@@ -95,7 +101,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil {
// and there was an error while creating a new file.
//
virtual bool EnsureFileExists(
- FileSystemOperationContext* context,
+ scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
const EnsureFileExistsCallback& callback) = 0;
@@ -115,7 +121,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil {
// - Other error code if it failed to create a directory.
//
virtual bool CreateDirectory(
- FileSystemOperationContext* context,
+ scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
bool exclusive,
bool recursive,
@@ -132,7 +138,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil {
// - Other error code if there was an error while retrieving the file info.
//
virtual bool GetFileInfo(
- FileSystemOperationContext* context,
+ scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
const GetFileInfoCallback& callback) = 0;
@@ -157,7 +163,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil {
// is a file (not a directory).
//
virtual bool ReadDirectory(
- FileSystemOperationContext* context,
+ scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
const ReadDirectoryCallback& callback) = 0;
@@ -170,7 +176,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil {
//
// This returns false if it fails to post an async task.
virtual bool Touch(
- FileSystemOperationContext* context,
+ scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
const base::Time& last_access_time,
const base::Time& last_modified_time,
@@ -188,7 +194,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil {
// - PLATFORM_FILE_ERROR_NOT_FOUND if the file doesn't exist.
//
virtual bool Truncate(
- FileSystemOperationContext* context,
+ scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
int64 length,
const StatusCallback& callback) = 0;
@@ -211,7 +217,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil {
// its parent path is a file.
//
virtual bool CopyFileLocal(
- FileSystemOperationContext* context,
+ scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
const StatusCallback& callback) = 0;
@@ -234,7 +240,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil {
// its parent path is a file.
//
virtual bool MoveFileLocal(
- FileSystemOperationContext* context,
+ scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& src_url,
const FileSystemURL& dest_url,
const StatusCallback& callback) = 0;
@@ -255,7 +261,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil {
// its parent path is a file.
//
virtual bool CopyInForeignFile(
- FileSystemOperationContext* context,
+ scoped_ptr<FileSystemOperationContext> context,
const base::FilePath& src_file_path,
const FileSystemURL& dest_url,
const StatusCallback& callback) = 0;
@@ -271,7 +277,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil {
// - PLATFORM_FILE_ERROR_NOT_A_FILE if |url| is not a file.
//
virtual bool DeleteFile(
- FileSystemOperationContext* context,
+ scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
const StatusCallback& callback) = 0;
@@ -287,7 +293,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil {
// - PLATFORM_FILE_ERROR_NOT_EMPTY if |url| is not empty.
//
virtual bool DeleteDirectory(
- FileSystemOperationContext* context,
+ scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
const StatusCallback& callback) = 0;
@@ -325,7 +331,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil {
// dependent) in error cases, and the caller should always
// check the return code.
virtual bool CreateSnapshotFile(
- FileSystemOperationContext* context,
+ scoped_ptr<FileSystemOperationContext> context,
const FileSystemURL& url,
const CreateSnapshotFileCallback& callback) = 0;
« no previous file with comments | « webkit/browser/chromeos/fileapi/remote_file_system_operation.cc ('k') | webkit/browser/fileapi/async_file_util_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698