diff options
author | teravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-01 04:03:21 +0000 |
---|---|---|
committer | teravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-01 04:03:21 +0000 |
commit | b1ce8b05fd81ba0c2e35fb95607fd3925654a978 (patch) | |
tree | 9f82a897f7ccb1f4951a1128f8820e6520ba249f /ppapi/proxy | |
parent | 80df04d46931a1614f24bb85b9f7aac1b76f5b49 (diff) | |
download | chromium_src-b1ce8b05fd81ba0c2e35fb95607fd3925654a978.zip chromium_src-b1ce8b05fd81ba0c2e35fb95607fd3925654a978.tar.gz chromium_src-b1ce8b05fd81ba0c2e35fb95607fd3925654a978.tar.bz2 |
Pepper: Use browser and renderer for FileSystem.
FileSystem resources have hosts checked in for the browser and renderer. Today,
we only use the renderer resource host, but to support FileRef in the browser,
we need to use the resource host in the browser as well.
BUG=225441
Review URL: https://chromiumcodereview.appspot.com/18031018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214946 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy')
-rw-r--r-- | ppapi/proxy/file_system_resource.cc | 18 | ||||
-rw-r--r-- | ppapi/proxy/file_system_resource.h | 1 |
2 files changed, 17 insertions, 2 deletions
diff --git a/ppapi/proxy/file_system_resource.cc b/ppapi/proxy/file_system_resource.cc index 16c92e8..5acac00 100644 --- a/ppapi/proxy/file_system_resource.cc +++ b/ppapi/proxy/file_system_resource.cc @@ -20,9 +20,13 @@ FileSystemResource::FileSystemResource(Connection connection, PP_FileSystemType type) : PluginResource(connection, instance), type_(type), - called_open_(false) { + called_open_(false), + callback_count_(0) { DCHECK(type_ != PP_FILESYSTEMTYPE_INVALID); + // TODO(teravest): Temporarily create hosts in both the browser and renderer + // while we move file related hosts to the browser. SendCreate(RENDERER, PpapiHostMsg_FileSystem_Create(type_)); + SendCreate(BROWSER, PpapiHostMsg_FileSystem_Create(type_)); } FileSystemResource::~FileSystemResource() { @@ -43,6 +47,11 @@ int32_t FileSystemResource::Open(int64_t expected_size, base::Bind(&FileSystemResource::OpenComplete, this, callback)); + Call<PpapiPluginMsg_FileSystem_OpenReply>(BROWSER, + PpapiHostMsg_FileSystem_Open(expected_size), + base::Bind(&FileSystemResource::OpenComplete, + this, + callback)); return PP_OK_COMPLETIONPENDING; } @@ -53,12 +62,17 @@ PP_FileSystemType FileSystemResource::GetType() { void FileSystemResource::InitIsolatedFileSystem(const char* fsid) { Post(RENDERER, PpapiHostMsg_FileSystem_InitIsolatedFileSystem(std::string(fsid))); + Post(BROWSER, + PpapiHostMsg_FileSystem_InitIsolatedFileSystem(std::string(fsid))); } void FileSystemResource::OpenComplete( scoped_refptr<TrackedCallback> callback, const ResourceMessageReplyParams& params) { - callback->Run(params.result()); + ++callback_count_; + // Received callback from browser and renderer. + if (callback_count_ == 2) + callback->Run(params.result()); } } // namespace proxy diff --git a/ppapi/proxy/file_system_resource.h b/ppapi/proxy/file_system_resource.h index 8be0b2d..b104db3 100644 --- a/ppapi/proxy/file_system_resource.h +++ b/ppapi/proxy/file_system_resource.h @@ -47,6 +47,7 @@ class PPAPI_PROXY_EXPORT FileSystemResource PP_FileSystemType type_; bool called_open_; + uint32_t callback_count_; DISALLOW_COPY_AND_ASSIGN(FileSystemResource); }; |