diff options
author | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-25 18:11:13 +0000 |
---|---|---|
committer | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-25 18:11:13 +0000 |
commit | 4837a98696485a8e07b1e4ad742a60ab02c73f08 (patch) | |
tree | 1eb1466622008a825ab6b07877bad835682441b9 /ppapi | |
parent | d57a7db463e142db2937bbe8f71ad514ca0e88ac (diff) | |
download | chromium_src-4837a98696485a8e07b1e4ad742a60ab02c73f08.zip chromium_src-4837a98696485a8e07b1e4ad742a60ab02c73f08.tar.gz chromium_src-4837a98696485a8e07b1e4ad742a60ab02c73f08.tar.bz2 |
Pepper: Create FileSystemOperationRunner in FileSystemHost.
This change adds a FileSystemOperationRunner to FileSystemHost
to be shared by all FileIOHosts within that file system.
FileIOResource now holds a reference to the FileSystemResource
to guarantee that the FileSystemHost isn't destroyed.
FileRefHost now provides GetFileSystemHost so FileIOHost can
get a weak reference to it.
This change is in preparation for future CLs where quota is
managed per file system.
BUG=194304
Review URL: https://codereview.chromium.org/83043007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237100 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/proxy/file_io_resource.cc | 11 | ||||
-rw-r--r-- | ppapi/proxy/file_io_resource.h | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/ppapi/proxy/file_io_resource.cc b/ppapi/proxy/file_io_resource.cc index b46b31a..f46cc17 100644 --- a/ppapi/proxy/file_io_resource.cc +++ b/ppapi/proxy/file_io_resource.cc @@ -10,6 +10,7 @@ #include "ppapi/c/pp_errors.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/shared_impl/array_writer.h" +#include "ppapi/shared_impl/file_ref_create_info.h" #include "ppapi/shared_impl/file_system_util.h" #include "ppapi/shared_impl/file_type_conversion.h" #include "ppapi/shared_impl/ppapi_globals.h" @@ -97,18 +98,22 @@ int32_t FileIOResource::Open(PP_Resource file_ref, return PP_ERROR_BADRESOURCE; PPB_FileRef_API* file_ref_api = enter.object(); - PP_FileSystemType type = file_ref_api->GetFileSystemType(); - if (!FileSystemTypeIsValid(type)) { + const FileRefCreateInfo& create_info = file_ref_api->GetCreateInfo(); + if (!FileSystemTypeIsValid(create_info.file_system_type)) { NOTREACHED(); return PP_ERROR_FAILED; } - file_system_type_ = type; int32_t rv = state_manager_.CheckOperationState( FileIOStateManager::OPERATION_EXCLUSIVE, false); if (rv != PP_OK) return rv; + file_system_type_ = create_info.file_system_type; + // Keep the FileSystem host alive by taking a reference to its resource. The + // FileIO host uses the FileSystem host for running tasks. + file_system_resource_ = create_info.file_system_plugin_resource; + // Take a reference on the FileRef resource while we're opening the file; we // don't want the plugin destroying it during the Open operation. file_ref_ = enter.resource(); diff --git a/ppapi/proxy/file_io_resource.h b/ppapi/proxy/file_io_resource.h index 5fc6370..ee19848 100644 --- a/ppapi/proxy/file_io_resource.h +++ b/ppapi/proxy/file_io_resource.h @@ -15,6 +15,7 @@ #include "ppapi/proxy/ppapi_proxy_export.h" #include "ppapi/shared_impl/file_io_state_manager.h" #include "ppapi/shared_impl/resource.h" +#include "ppapi/shared_impl/scoped_pp_resource.h" #include "ppapi/thunk/ppb_file_io_api.h" namespace ppapi { @@ -163,6 +164,7 @@ class PPAPI_PROXY_EXPORT FileIOResource scoped_refptr<FileHandleHolder> file_handle_; PP_FileSystemType file_system_type_; + ScopedPPResource file_system_resource_; FileIOStateManager state_manager_; scoped_refptr<Resource> file_ref_; |