summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorcsharp@chromium.org <csharp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-01 20:37:21 +0000
committercsharp@chromium.org <csharp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-01 20:37:21 +0000
commit12e9913cd1d7c2c4b3aa49ed006b33b1b1fa5515 (patch)
tree33135f3eb6a4176210de966c4f31f7e81dfec509 /webkit
parentef452a2612cc3d1567fb54c2ac444cbaf8adcd5f (diff)
downloadchromium_src-12e9913cd1d7c2c4b3aa49ed006b33b1b1fa5515.zip
chromium_src-12e9913cd1d7c2c4b3aa49ed006b33b1b1fa5515.tar.gz
chromium_src-12e9913cd1d7c2c4b3aa49ed006b33b1b1fa5515.tar.bz2
Revert 232440 "Pepper: Move FileIO host from renderer to browser."
Broke the Linux ASAN Test (2) bot. > Pepper: Move FileIO host from renderer to browser. > > This change is large because it moves QuotaFileIO and PepperFileIOHost all at > once to the browser process. Some code in the refactored PepperFileIOHost is > moved from what's provided in FileAPIMessageFilter. > > Tested locally with Bastion, From Dust, and Angry Bots. > > TBR=jschuh > BUG=246396 > > Review URL: https://codereview.chromium.org/33053002 TBR=teravest@chromium.org Review URL: https://codereview.chromium.org/51213008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232460 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/browser/fileapi/file_system_operation.h7
-rw-r--r--webkit/browser/fileapi/file_system_operation_impl.cc13
-rw-r--r--webkit/browser/fileapi/file_system_operation_impl.h5
-rw-r--r--webkit/browser/fileapi/file_system_operation_runner.cc12
-rw-r--r--webkit/browser/fileapi/file_system_operation_runner.h4
5 files changed, 31 insertions, 10 deletions
diff --git a/webkit/browser/fileapi/file_system_operation.h b/webkit/browser/fileapi/file_system_operation.h
index ded87f7..8ff6956 100644
--- a/webkit/browser/fileapi/file_system_operation.h
+++ b/webkit/browser/fileapi/file_system_operation.h
@@ -80,7 +80,8 @@ class FileSystemOperation {
typedef base::Callback<
void(base::PlatformFileError result,
base::PlatformFile file,
- const base::Closure& on_close_callback)> OpenFileCallback;
+ const base::Closure& on_close_callback,
+ base::ProcessHandle peer_handle)> OpenFileCallback;
// Used for ReadDirectoryCallback.
typedef std::vector<DirectoryEntry> FileEntryList;
@@ -354,9 +355,13 @@ class FileSystemOperation {
// Opens a file at |path| 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.
virtual void OpenFile(const FileSystemURL& path,
int file_flags,
+ base::ProcessHandle peer_handle,
const OpenFileCallback& callback) = 0;
// Creates a local snapshot file for a given |path| and returns the
diff --git a/webkit/browser/fileapi/file_system_operation_impl.cc b/webkit/browser/fileapi/file_system_operation_impl.cc
index 180e120..3b4dbaf 100644
--- a/webkit/browser/fileapi/file_system_operation_impl.cc
+++ b/webkit/browser/fileapi/file_system_operation_impl.cc
@@ -199,14 +199,17 @@ void FileSystemOperationImpl::TouchFile(const FileSystemURL& url,
void FileSystemOperationImpl::OpenFile(const FileSystemURL& url,
int file_flags,
+ base::ProcessHandle peer_handle,
const OpenFileCallback& callback) {
DCHECK(SetPendingOperationType(kOperationOpenFile));
+ peer_handle_ = peer_handle;
if (file_flags &
(base::PLATFORM_FILE_TEMPORARY | base::PLATFORM_FILE_HIDDEN)) {
callback.Run(base::PLATFORM_FILE_ERROR_FAILED,
base::kInvalidPlatformFileValue,
- base::Closure());
+ base::Closure(),
+ base::kNullProcessHandle);
return;
}
GetUsageAndQuotaThenRunTask(
@@ -216,7 +219,8 @@ void FileSystemOperationImpl::OpenFile(const FileSystemURL& url,
url, callback, file_flags),
base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED,
base::kInvalidPlatformFileValue,
- base::Closure()));
+ base::Closure(),
+ base::kNullProcessHandle));
}
// We can only get here on a write or truncate that's not yet completed.
@@ -331,6 +335,7 @@ FileSystemOperationImpl::FileSystemOperationImpl(
: file_system_context_(file_system_context),
operation_context_(operation_context.Pass()),
async_file_util_(NULL),
+ peer_handle_(base::kNullProcessHandle),
pending_operation_(kOperationNone),
weak_factory_(this) {
DCHECK(operation_context_.get());
@@ -548,7 +553,9 @@ void FileSystemOperationImpl::DidOpenFile(
base::PlatformFileError rv,
base::PassPlatformFile file,
const base::Closure& on_close_callback) {
- callback.Run(rv, file.ReleaseValue(), on_close_callback);
+ if (rv == base::PLATFORM_FILE_OK)
+ CHECK_NE(base::kNullProcessHandle, peer_handle_);
+ callback.Run(rv, file.ReleaseValue(), on_close_callback, peer_handle_);
}
bool FileSystemOperationImpl::SetPendingOperationType(OperationType type) {
diff --git a/webkit/browser/fileapi/file_system_operation_impl.h b/webkit/browser/fileapi/file_system_operation_impl.h
index 0625995..a4fa3fe 100644
--- a/webkit/browser/fileapi/file_system_operation_impl.h
+++ b/webkit/browser/fileapi/file_system_operation_impl.h
@@ -69,6 +69,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationImpl
const StatusCallback& callback) OVERRIDE;
virtual void OpenFile(const FileSystemURL& url,
int file_flags,
+ base::ProcessHandle peer_handle,
const OpenFileCallback& callback) OVERRIDE;
virtual void Cancel(const StatusCallback& cancel_callback) OVERRIDE;
virtual void CreateSnapshotFile(
@@ -194,6 +195,10 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationImpl
StatusCallback cancel_callback_;
+ // Used only by OpenFile, in order to clone the file handle back to the
+ // requesting process.
+ base::ProcessHandle peer_handle_;
+
// A flag to make sure we call operation only once per instance.
OperationType pending_operation_;
diff --git a/webkit/browser/fileapi/file_system_operation_runner.cc b/webkit/browser/fileapi/file_system_operation_runner.cc
index d552a78..8903187 100644
--- a/webkit/browser/fileapi/file_system_operation_runner.cc
+++ b/webkit/browser/fileapi/file_system_operation_runner.cc
@@ -339,6 +339,7 @@ OperationID FileSystemOperationRunner::TouchFile(
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 =
@@ -347,7 +348,7 @@ OperationID FileSystemOperationRunner::OpenFile(
OperationHandle handle = BeginOperation(operation, scope.AsWeakPtr());
if (!operation) {
DidOpenFile(handle, callback, error, base::kInvalidPlatformFileValue,
- base::Closure());
+ base::Closure(), base::ProcessHandle());
return handle.id;
}
if (file_flags &
@@ -361,7 +362,7 @@ OperationID FileSystemOperationRunner::OpenFile(
PrepareForRead(handle.id, url);
}
operation->OpenFile(
- url, file_flags,
+ url, file_flags, peer_handle,
base::Bind(&FileSystemOperationRunner::DidOpenFile, AsWeakPtr(),
handle, callback));
return handle.id;
@@ -577,16 +578,17 @@ void FileSystemOperationRunner::DidOpenFile(
const OpenFileCallback& callback,
base::PlatformFileError rv,
base::PlatformFile file,
- const base::Closure& on_close_callback) {
+ const base::Closure& on_close_callback,
+ base::ProcessHandle peer_handle) {
if (handle.scope) {
finished_operations_.insert(handle.id);
base::MessageLoopProxy::current()->PostTask(
FROM_HERE, base::Bind(&FileSystemOperationRunner::DidOpenFile,
AsWeakPtr(), handle, callback, rv, file,
- on_close_callback));
+ on_close_callback, peer_handle));
return;
}
- callback.Run(rv, file, on_close_callback);
+ callback.Run(rv, file, on_close_callback, peer_handle);
FinishOperation(handle.id);
}
diff --git a/webkit/browser/fileapi/file_system_operation_runner.h b/webkit/browser/fileapi/file_system_operation_runner.h
index fba6b1c..b19a700 100644
--- a/webkit/browser/fileapi/file_system_operation_runner.h
+++ b/webkit/browser/fileapi/file_system_operation_runner.h
@@ -145,6 +145,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner
// 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
@@ -273,7 +274,8 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner
const OpenFileCallback& callback,
base::PlatformFileError rv,
base::PlatformFile file,
- const base::Closure& on_close_callback);
+ const base::Closure& on_close_callback,
+ base::ProcessHandle peer_handle);
void DidCreateSnapshot(
const OperationHandle& handle,
const SnapshotFileCallback& callback,