summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-05 13:05:16 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-05 13:05:16 +0000
commit6fb9264a219ee2fbb03a77170046e436fff55999 (patch)
tree379b77dfd4280d45e490b0175cc880da18714f2d /webkit
parent4bd9de4b88a29bffee00cfe70a8c1519e0793b35 (diff)
downloadchromium_src-6fb9264a219ee2fbb03a77170046e436fff55999.zip
chromium_src-6fb9264a219ee2fbb03a77170046e436fff55999.tar.gz
chromium_src-6fb9264a219ee2fbb03a77170046e436fff55999.tar.bz2
Add FileSystemOperationRunner and stop directly creating FileSystemOperation
Factor out FileSystemOperation creation and internal bookkeeping from FileAPIMessageFilter into FileSystemOperationRunner. This is the first cut to stop calling CreateFileSystemOperation directly at the callsites. BUG=176444 TEST=existing tests R=tzik@chromium.org Review URL: https://codereview.chromium.org/16424002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@204242 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/browser/fileapi/file_system_context.cc4
-rw-r--r--webkit/browser/fileapi/file_system_context.h8
-rw-r--r--webkit/browser/fileapi/file_system_operation_runner.cc371
-rw-r--r--webkit/browser/fileapi/file_system_operation_runner.h189
-rw-r--r--webkit/browser/fileapi/webkit_browser_fileapi.gypi2
5 files changed, 573 insertions, 1 deletions
diff --git a/webkit/browser/fileapi/file_system_context.cc b/webkit/browser/fileapi/file_system_context.cc
index dc7bfd1..2d7fdb5 100644
--- a/webkit/browser/fileapi/file_system_context.cc
+++ b/webkit/browser/fileapi/file_system_context.cc
@@ -14,6 +14,7 @@
#include "webkit/browser/fileapi/file_stream_writer.h"
#include "webkit/browser/fileapi/file_system_file_util.h"
#include "webkit/browser/fileapi/file_system_operation.h"
+#include "webkit/browser/fileapi/file_system_operation_runner.h"
#include "webkit/browser/fileapi/file_system_options.h"
#include "webkit/browser/fileapi/file_system_quota_client.h"
#include "webkit/browser/fileapi/file_system_task_runners.h"
@@ -76,7 +77,8 @@ FileSystemContext::FileSystemContext(
isolated_provider_(new IsolatedMountPointProvider()),
additional_providers_(additional_providers.Pass()),
external_mount_points_(external_mount_points),
- partition_path_(partition_path) {
+ partition_path_(partition_path),
+ operation_runner_(new FileSystemOperationRunner(this)) {
DCHECK(task_runners_.get());
if (quota_manager_proxy) {
diff --git a/webkit/browser/fileapi/file_system_context.h b/webkit/browser/fileapi/file_system_context.h
index 102a7d2..d7a3b66 100644
--- a/webkit/browser/fileapi/file_system_context.h
+++ b/webkit/browser/fileapi/file_system_context.h
@@ -54,6 +54,7 @@ class FileStreamWriter;
class FileSystemFileUtil;
class FileSystemMountPointProvider;
class FileSystemOperation;
+class FileSystemOperationRunner;
class FileSystemOptions;
class FileSystemQuotaUtil;
class FileSystemTaskRunners;
@@ -179,6 +180,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemContext
FileSystemType type,
const DeleteFileSystemCallback& callback);
+ // TODO(kinuko): Make this private to FileSystemOperationRunner.
// Creates a new FileSystemOperation instance by getting an appropriate
// MountPointProvider for |url| and calling the provider's corresponding
// CreateFileSystemOperation method.
@@ -211,6 +213,10 @@ class WEBKIT_STORAGE_EXPORT FileSystemContext
FileSystemTaskRunners* task_runners() { return task_runners_.get(); }
+ FileSystemOperationRunner* operation_runner() {
+ return operation_runner_.get();
+ }
+
sync_file_system::LocalFileChangeTracker* change_tracker() {
return change_tracker_.get();
}
@@ -296,6 +302,8 @@ class WEBKIT_STORAGE_EXPORT FileSystemContext
scoped_ptr<sync_file_system::LocalFileChangeTracker> change_tracker_;
scoped_refptr<sync_file_system::LocalFileSyncContext> sync_context_;
+ scoped_ptr<FileSystemOperationRunner> operation_runner_;
+
DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext);
};
diff --git a/webkit/browser/fileapi/file_system_operation_runner.cc b/webkit/browser/fileapi/file_system_operation_runner.cc
new file mode 100644
index 0000000..ae37bb7
--- /dev/null
+++ b/webkit/browser/fileapi/file_system_operation_runner.cc
@@ -0,0 +1,371 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/browser/fileapi/file_system_operation_runner.h"
+
+#include "base/bind.h"
+#include "webkit/browser/fileapi/file_system_context.h"
+#include "webkit/common/blob/shareable_file_reference.h"
+
+namespace fileapi {
+
+typedef FileSystemOperationRunner::OperationID OperationID;
+
+const OperationID FileSystemOperationRunner::kErrorOperationID = -1;
+
+FileSystemOperationRunner::~FileSystemOperationRunner() {
+}
+
+OperationID FileSystemOperationRunner::CreateFile(
+ const FileSystemURL& url,
+ bool exclusive,
+ const StatusCallback& callback) {
+ base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ FileSystemOperation* operation =
+ file_system_context_->CreateFileSystemOperation(url, &error);
+ if (!operation) {
+ callback.Run(error);
+ return kErrorOperationID;
+ }
+ OperationID id = operations_.Add(operation);
+ operation->CreateFile(
+ url, exclusive,
+ base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(),
+ id, callback));
+ return id;
+}
+
+OperationID FileSystemOperationRunner::CreateDirectory(
+ const FileSystemURL& url,
+ bool exclusive,
+ bool recursive,
+ const StatusCallback& callback) {
+ base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ FileSystemOperation* operation =
+ file_system_context_->CreateFileSystemOperation(url, &error);
+ if (!operation) {
+ callback.Run(error);
+ return kErrorOperationID;
+ }
+ OperationID id = operations_.Add(operation);
+ operation->CreateDirectory(
+ url, exclusive, recursive,
+ base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(),
+ id, callback));
+ return id;
+}
+
+OperationID FileSystemOperationRunner::Copy(
+ const FileSystemURL& src_url,
+ const FileSystemURL& dest_url,
+ const StatusCallback& callback) {
+ base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ FileSystemOperation* operation =
+ file_system_context_->CreateFileSystemOperation(dest_url, &error);
+ if (!operation) {
+ callback.Run(error);
+ return kErrorOperationID;
+ }
+ OperationID id = operations_.Add(operation);
+ operation->Copy(
+ src_url, dest_url,
+ base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(),
+ id, callback));
+ return id;
+}
+
+OperationID FileSystemOperationRunner::Move(
+ const FileSystemURL& src_url,
+ const FileSystemURL& dest_url,
+ const StatusCallback& callback) {
+ base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ FileSystemOperation* operation =
+ file_system_context_->CreateFileSystemOperation(dest_url, &error);
+ if (!operation) {
+ callback.Run(error);
+ return kErrorOperationID;
+ }
+ OperationID id = operations_.Add(operation);
+ operation->Move(
+ src_url, dest_url,
+ base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(),
+ id, callback));
+ return id;
+}
+
+OperationID FileSystemOperationRunner::DirectoryExists(
+ const FileSystemURL& url,
+ const StatusCallback& callback) {
+ base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ FileSystemOperation* operation =
+ file_system_context_->CreateFileSystemOperation(url, &error);
+ if (!operation) {
+ callback.Run(error);
+ return kErrorOperationID;
+ }
+ OperationID id = operations_.Add(operation);
+ operation->DirectoryExists(
+ url,
+ base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(),
+ id, callback));
+ return id;
+}
+
+OperationID FileSystemOperationRunner::FileExists(
+ const FileSystemURL& url,
+ const StatusCallback& callback) {
+ base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ FileSystemOperation* operation =
+ file_system_context_->CreateFileSystemOperation(url, &error);
+ if (!operation) {
+ callback.Run(error);
+ return kErrorOperationID;
+ }
+ OperationID id = operations_.Add(operation);
+ operation->FileExists(
+ url,
+ base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(),
+ id, callback));
+ return id;
+}
+
+OperationID FileSystemOperationRunner::GetMetadata(
+ const FileSystemURL& url,
+ const GetMetadataCallback& callback) {
+ base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ FileSystemOperation* operation =
+ file_system_context_->CreateFileSystemOperation(url, &error);
+ if (!operation) {
+ callback.Run(error, base::PlatformFileInfo(), base::FilePath());
+ return kErrorOperationID;
+ }
+ OperationID id = operations_.Add(operation);
+ operation->GetMetadata(
+ url,
+ base::Bind(&FileSystemOperationRunner::DidGetMetadata, AsWeakPtr(),
+ id, callback));
+ return id;
+}
+
+OperationID FileSystemOperationRunner::ReadDirectory(
+ const FileSystemURL& url,
+ const ReadDirectoryCallback& callback) {
+ base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ FileSystemOperation* operation =
+ file_system_context_->CreateFileSystemOperation(url, &error);
+ if (!operation) {
+ callback.Run(error, std::vector<DirectoryEntry>(), false);
+ return kErrorOperationID;
+ }
+ OperationID id = operations_.Add(operation);
+ operation->ReadDirectory(
+ url,
+ base::Bind(&FileSystemOperationRunner::DidReadDirectory, AsWeakPtr(),
+ id, callback));
+ return id;
+}
+
+OperationID FileSystemOperationRunner::Remove(
+ const FileSystemURL& url, bool recursive,
+ const StatusCallback& callback) {
+ base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ FileSystemOperation* operation =
+ file_system_context_->CreateFileSystemOperation(url, &error);
+ if (!operation) {
+ callback.Run(error);
+ return kErrorOperationID;
+ }
+ OperationID id = operations_.Add(operation);
+ operation->Remove(
+ url, recursive,
+ base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(),
+ id, callback));
+ return id;
+}
+
+OperationID FileSystemOperationRunner::Write(
+ const net::URLRequestContext* url_request_context,
+ const FileSystemURL& url,
+ const GURL& blob_url,
+ int64 offset,
+ const WriteCallback& callback) {
+ base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ FileSystemOperation* operation =
+ file_system_context_->CreateFileSystemOperation(url, &error);
+ if (!operation) {
+ callback.Run(error, 0, true);
+ return kErrorOperationID;
+ }
+ OperationID id = operations_.Add(operation);
+ operation->Write(
+ url_request_context, url, blob_url, offset,
+ base::Bind(&FileSystemOperationRunner::DidWrite, AsWeakPtr(),
+ id, callback));
+ return id;
+}
+
+OperationID FileSystemOperationRunner::Truncate(
+ const FileSystemURL& url, int64 length,
+ const StatusCallback& callback) {
+ base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ FileSystemOperation* operation =
+ file_system_context_->CreateFileSystemOperation(url, &error);
+ if (!operation) {
+ callback.Run(error);
+ return kErrorOperationID;
+ }
+ OperationID id = operations_.Add(operation);
+ operation->Truncate(
+ url, length,
+ base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(),
+ id, callback));
+ return id;
+}
+
+void FileSystemOperationRunner::Cancel(
+ OperationID id,
+ const StatusCallback& callback) {
+ FileSystemOperation* operation = operations_.Lookup(id);
+ if (!operation) {
+ // The operation is already finished; report that we failed to stop it.
+ callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION);
+ return;
+ }
+ operation->Cancel(callback);
+}
+
+OperationID FileSystemOperationRunner::TouchFile(
+ const FileSystemURL& url,
+ const base::Time& last_access_time,
+ const base::Time& last_modified_time,
+ const StatusCallback& callback) {
+ base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ FileSystemOperation* operation =
+ file_system_context_->CreateFileSystemOperation(url, &error);
+ if (!operation) {
+ callback.Run(error);
+ return kErrorOperationID;
+ }
+ OperationID id = operations_.Add(operation);
+ operation->TouchFile(
+ url, last_access_time, last_modified_time,
+ base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(),
+ id, callback));
+ return id;
+}
+
+OperationID FileSystemOperationRunner::OpenFile(
+ const FileSystemURL& url,
+ int file_flags,
+ base::ProcessHandle peer_handle,
+ const OpenFileCallback& callback) {
+ base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ FileSystemOperation* operation =
+ file_system_context_->CreateFileSystemOperation(url, &error);
+ if (!operation) {
+ callback.Run(error, base::kInvalidPlatformFileValue,
+ base::Closure(), base::ProcessHandle());
+ return kErrorOperationID;
+ }
+ OperationID id = operations_.Add(operation);
+ operation->OpenFile(
+ url, file_flags, peer_handle,
+ base::Bind(&FileSystemOperationRunner::DidOpenFile, AsWeakPtr(),
+ id, callback));
+ return id;
+}
+
+OperationID FileSystemOperationRunner::CreateSnapshotFile(
+ const FileSystemURL& url,
+ const SnapshotFileCallback& callback) {
+ base::PlatformFileError error = base::PLATFORM_FILE_OK;
+ FileSystemOperation* operation =
+ file_system_context_->CreateFileSystemOperation(url, &error);
+ if (!operation) {
+ callback.Run(error, base::PlatformFileInfo(), base::FilePath(), NULL);
+ return kErrorOperationID;
+ }
+ OperationID id = operations_.Add(operation);
+ operation->CreateSnapshotFile(
+ url,
+ base::Bind(&FileSystemOperationRunner::DidCreateSnapshot, AsWeakPtr(),
+ id, callback));
+ return id;
+}
+
+FileSystemOperationRunner::FileSystemOperationRunner(
+ FileSystemContext* file_system_context)
+ : file_system_context_(file_system_context) {}
+
+void FileSystemOperationRunner::DidFinish(
+ OperationID id,
+ const StatusCallback& callback,
+ base::PlatformFileError rv) {
+ callback.Run(rv);
+ DCHECK(operations_.Lookup(id));
+ operations_.Remove(id);
+}
+
+void FileSystemOperationRunner::DidGetMetadata(
+ OperationID id,
+ const GetMetadataCallback& callback,
+ base::PlatformFileError rv,
+ const base::PlatformFileInfo& file_info,
+ const base::FilePath& platform_path) {
+ callback.Run(rv, file_info, platform_path);
+ DCHECK(operations_.Lookup(id));
+ operations_.Remove(id);
+}
+
+void FileSystemOperationRunner::DidReadDirectory(
+ OperationID id,
+ const ReadDirectoryCallback& callback,
+ base::PlatformFileError rv,
+ const std::vector<DirectoryEntry>& entries,
+ bool has_more) {
+ callback.Run(rv, entries, has_more);
+ if (rv != base::PLATFORM_FILE_OK || !has_more) {
+ DCHECK(operations_.Lookup(id));
+ operations_.Remove(id);
+ }
+}
+
+void FileSystemOperationRunner::DidWrite(
+ OperationID id,
+ const WriteCallback& callback,
+ base::PlatformFileError rv,
+ int64 bytes,
+ bool complete) {
+ callback.Run(rv, bytes, complete);
+ if (rv != base::PLATFORM_FILE_OK || complete) {
+ DCHECK(operations_.Lookup(id));
+ operations_.Remove(id);
+ }
+}
+
+void FileSystemOperationRunner::DidOpenFile(
+ OperationID id,
+ const OpenFileCallback& callback,
+ base::PlatformFileError rv,
+ base::PlatformFile file,
+ const base::Closure& on_close_callback,
+ base::ProcessHandle peer_handle) {
+ callback.Run(rv, file, on_close_callback, peer_handle);
+ DCHECK(operations_.Lookup(id));
+ operations_.Remove(id);
+}
+
+void FileSystemOperationRunner::DidCreateSnapshot(
+ OperationID id,
+ const SnapshotFileCallback& callback,
+ base::PlatformFileError rv,
+ const base::PlatformFileInfo& file_info,
+ const base::FilePath& platform_path,
+ const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
+ callback.Run(rv, file_info, platform_path, file_ref);
+ DCHECK(operations_.Lookup(id));
+ operations_.Remove(id);
+}
+
+} // namespace fileapi
diff --git a/webkit/browser/fileapi/file_system_operation_runner.h b/webkit/browser/fileapi/file_system_operation_runner.h
new file mode 100644
index 0000000..52ab112
--- /dev/null
+++ b/webkit/browser/fileapi/file_system_operation_runner.h
@@ -0,0 +1,189 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_
+#define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_
+
+#include "base/basictypes.h"
+#include "base/id_map.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "webkit/browser/fileapi/file_system_operation.h"
+#include "webkit/storage/webkit_storage_export.h"
+
+namespace fileapi {
+
+class FileSystemURL;
+class FileSystemContext;
+
+// A central interface for running FileSystem API operations.
+// All operation methods take callback and returns OperationID, which is
+// an integer value which can be used for cancelling an operation.
+// All operation methods return kErrorOperationID if running (posting) an
+// operation fails, in addition to dispatching the callback with an error
+// code (therefore in most cases the caller does not need to check the
+// returned operation ID).
+class WEBKIT_STORAGE_EXPORT FileSystemOperationRunner
+ : public base::SupportsWeakPtr<FileSystemOperationRunner> {
+ public:
+ typedef FileSystemOperation::GetMetadataCallback GetMetadataCallback;
+ typedef FileSystemOperation::ReadDirectoryCallback ReadDirectoryCallback;
+ typedef FileSystemOperation::SnapshotFileCallback SnapshotFileCallback;
+ typedef FileSystemOperation::StatusCallback StatusCallback;
+ typedef FileSystemOperation::WriteCallback WriteCallback;
+ typedef FileSystemOperation::OpenFileCallback OpenFileCallback;
+
+ typedef int OperationID;
+
+ static const OperationID kErrorOperationID;
+
+ virtual ~FileSystemOperationRunner();
+
+ // Creates a file at |url|. If |exclusive| is true, an error is raised
+ // in case a file is already present at the URL.
+ OperationID CreateFile(const FileSystemURL& url,
+ bool exclusive,
+ const StatusCallback& callback);
+
+ OperationID CreateDirectory(const FileSystemURL& url,
+ bool exclusive,
+ bool recursive,
+ const StatusCallback& callback);
+
+ // Copies a file or directory from |src_url| to |dest_url|. If
+ // |src_url| is a directory, the contents of |src_url| are copied to
+ // |dest_url| recursively. A new file or directory is created at
+ // |dest_url| as needed.
+ OperationID Copy(const FileSystemURL& src_url,
+ const FileSystemURL& dest_url,
+ const StatusCallback& callback);
+
+ // Moves a file or directory from |src_url| to |dest_url|. A new file
+ // or directory is created at |dest_url| as needed.
+ OperationID Move(const FileSystemURL& src_url,
+ const FileSystemURL& dest_url,
+ const StatusCallback& callback);
+
+ // Checks if a directory is present at |url|.
+ OperationID DirectoryExists(const FileSystemURL& url,
+ const StatusCallback& callback);
+
+ // Checks if a file is present at |url|.
+ OperationID FileExists(const FileSystemURL& url,
+ const StatusCallback& callback);
+
+ // Gets the metadata of a file or directory at |url|.
+ OperationID GetMetadata(const FileSystemURL& url,
+ const GetMetadataCallback& callback);
+
+ // Reads contents of a directory at |url|.
+ OperationID ReadDirectory(const FileSystemURL& url,
+ const ReadDirectoryCallback& callback);
+
+ // Removes a file or directory at |url|. If |recursive| is true, remove
+ // all files and directories under the directory at |url| recursively.
+ OperationID Remove(const FileSystemURL& url, bool recursive,
+ const StatusCallback& callback);
+
+ // Writes contents of |blob_url| to |url| at |offset|.
+ // |url_request_context| is used to read contents in |blob_url|.
+ OperationID Write(const net::URLRequestContext* url_request_context,
+ const FileSystemURL& url,
+ const GURL& blob_url,
+ int64 offset,
+ const WriteCallback& callback);
+
+ // Truncates a file at |url| to |length|. If |length| is larger than
+ // the original file size, the file will be extended, and the extended
+ // part is filled with null bytes.
+ OperationID Truncate(const FileSystemURL& url, int64 length,
+ const StatusCallback& callback);
+
+ // Tries to cancel the operation |id| [we support cancelling write or
+ // truncate only]. Reports failure for the current operation, then reports
+ // success for the cancel operation itself via the |callback|.
+ void Cancel(OperationID id, const StatusCallback& callback);
+
+ // Modifies timestamps of a file or directory at |url| with
+ // |last_access_time| and |last_modified_time|. The function DOES NOT
+ // create a file unlike 'touch' command on Linux.
+ //
+ // This function is used only by Pepper as of writing.
+ OperationID TouchFile(const FileSystemURL& url,
+ const base::Time& last_access_time,
+ const base::Time& last_modified_time,
+ const StatusCallback& callback);
+
+ // Opens a file at |url| with |file_flags|, where flags are OR'ed
+ // values of base::PlatformFileFlags.
+ //
+ // |peer_handle| is the process handle of a pepper plugin process, which
+ // is necessary for underlying IPC calls with Pepper plugins.
+ //
+ // This function is used only by Pepper as of writing.
+ OperationID OpenFile(const FileSystemURL& url,
+ int file_flags,
+ base::ProcessHandle peer_handle,
+ const OpenFileCallback& callback);
+
+ // Creates a local snapshot file for a given |url| and returns the
+ // metadata and platform url of the snapshot file via |callback|.
+ // In local filesystem cases the implementation may simply return
+ // the metadata of the file itself (as well as GetMetadata does),
+ // while in remote filesystem case the backend may want to download the file
+ // into a temporary snapshot file and return the metadata of the
+ // temporary file. Or if the implementaiton already has the local cache
+ // data for |url| it can simply return the url to the cache.
+ OperationID CreateSnapshotFile(const FileSystemURL& url,
+ const SnapshotFileCallback& callback);
+
+ private:
+ friend class FileSystemContext;
+ explicit FileSystemOperationRunner(FileSystemContext* file_system_context);
+
+ void DidFinish(OperationID id,
+ const StatusCallback& callback,
+ base::PlatformFileError rv);
+ void DidGetMetadata(OperationID id,
+ const GetMetadataCallback& callback,
+ base::PlatformFileError rv,
+ const base::PlatformFileInfo& file_info,
+ const base::FilePath& platform_path);
+ void DidReadDirectory(OperationID id,
+ const ReadDirectoryCallback& callback,
+ base::PlatformFileError rv,
+ const std::vector<DirectoryEntry>& entries,
+ bool has_more);
+ void DidWrite(OperationID id,
+ const WriteCallback& callback,
+ base::PlatformFileError rv,
+ int64 bytes,
+ bool complete);
+ void DidOpenFile(
+ OperationID id,
+ const OpenFileCallback& callback,
+ base::PlatformFileError rv,
+ base::PlatformFile file,
+ const base::Closure& on_close_callback,
+ base::ProcessHandle peer_handle);
+ void DidCreateSnapshot(
+ OperationID id,
+ const SnapshotFileCallback& callback,
+ base::PlatformFileError rv,
+ const base::PlatformFileInfo& file_info,
+ const base::FilePath& platform_path,
+ const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref);
+
+ // Not owned; file_system_context owns this.
+ FileSystemContext* file_system_context_;
+
+ // IDMap<FileSystemOperation, IDMapOwnPointer> operations_;
+ IDMap<FileSystemOperation> operations_;
+
+ DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunner);
+};
+
+} // namespace fileapi
+
+#endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_
diff --git a/webkit/browser/fileapi/webkit_browser_fileapi.gypi b/webkit/browser/fileapi/webkit_browser_fileapi.gypi
index 790cec0..8e30e06 100644
--- a/webkit/browser/fileapi/webkit_browser_fileapi.gypi
+++ b/webkit/browser/fileapi/webkit_browser_fileapi.gypi
@@ -27,6 +27,8 @@
'../browser/fileapi/file_system_file_util.h',
'../browser/fileapi/file_system_mount_point_provider.h',
'../browser/fileapi/file_system_operation.h',
+ '../browser/fileapi/file_system_operation_runner.cc',
+ '../browser/fileapi/file_system_operation_runner.h',
'../browser/fileapi/file_system_operation_context.cc',
'../browser/fileapi/file_system_operation_context.h',
'../browser/fileapi/file_system_options.cc',