diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-27 20:28:18 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-27 20:28:18 +0000 |
commit | 246fc49935cd37deba43624861f236acc016aa48 (patch) | |
tree | 8dbc89fc8304cfa0409dc83ccb8b94b01d3def8f /ppapi/proxy/ppb_image_data_proxy.cc | |
parent | 906960ba1d7a27bb458fca480a20aa33c61ebdb6 (diff) | |
download | chromium_src-246fc49935cd37deba43624861f236acc016aa48.zip chromium_src-246fc49935cd37deba43624861f236acc016aa48.tar.gz chromium_src-246fc49935cd37deba43624861f236acc016aa48.tar.bz2 |
PPAPI/NaCl: Make NaClIPCAdapter transfer handles more generally
This does a couple of things:
- It defines a new wrapper for passing any kind of handle through the PPAPI proxy (SerializedHandle).
- It updates nacl_ipc_adapter to have a more general way to pick apart messages based on their static types (which include the types of all the params).
- It adds support for PPB_Graphics2D and PPB_Graphics3D to the NaCl IPC proxy (e.g., NaCl SDK examples pi_generator and tumbler work in the new proxy with this patch).
The downside is it requires pulling parts of ppapi/shared_impl and ppapi/proxy in to the NaCl Win64 build.
BUG=116317
TEST=
Review URL: https://chromiumcodereview.appspot.com/10828023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153531 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_image_data_proxy.cc')
-rw-r--r-- | ppapi/proxy/ppb_image_data_proxy.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/ppapi/proxy/ppb_image_data_proxy.cc b/ppapi/proxy/ppb_image_data_proxy.cc index d7c621d..eca9749 100644 --- a/ppapi/proxy/ppb_image_data_proxy.cc +++ b/ppapi/proxy/ppb_image_data_proxy.cc @@ -326,7 +326,7 @@ ImageData::ImageData(const HostResource& resource, map_count_(0), used_in_replace_contents_(false) { } -#endif // !defined(OS_NACL) +#endif // else, !defined(OS_NACL) ImageData::~ImageData() { } @@ -465,10 +465,13 @@ PP_Resource PPB_ImageData_Proxy::CreateProxyResource(PP_Instance instance, HostResource result; std::string image_data_desc; #if defined(OS_NACL) - base::SharedMemoryHandle image_handle = base::SharedMemory::NULLHandle(); + ppapi::proxy::SerializedHandle image_handle_wrapper; dispatcher->Send(new PpapiHostMsg_PPBImageData_CreateNaCl( kApiID, instance, format, size, init_to_zero, - &result, &image_data_desc, &image_handle)); + &result, &image_data_desc, &image_handle_wrapper)); + if (!image_handle_wrapper.is_shmem()) + return 0; + base::SharedMemoryHandle image_handle = image_handle_wrapper.shmem(); #else ImageHandle image_handle = ImageData::NullHandle(); dispatcher->Send(new PpapiHostMsg_PPBImageData_Create( @@ -554,13 +557,13 @@ void PPB_ImageData_Proxy::OnHostMsgCreateNaCl( PP_Bool init_to_zero, HostResource* result, std::string* image_data_desc, - base::SharedMemoryHandle* result_image_handle) { + ppapi::proxy::SerializedHandle* result_image_handle) { #if defined(OS_NACL) // This message should never be received in untrusted code. To minimize the // size of the IRT, we just don't handle it. return; #else - *result_image_handle = base::SharedMemory::NULLHandle(); + result_image_handle->set_null_shmem(); HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); if (!dispatcher) return; @@ -588,7 +591,6 @@ void PPB_ImageData_Proxy::OnHostMsgCreateNaCl( uint32_t byte_count; if (enter_resource.object()->GetSharedMemory(&local_fd, &byte_count) != PP_OK) return; - // TODO(dmichael): Change trusted interface to return a PP_FileHandle, those // casts are ugly. base::PlatformFile platform_file = @@ -599,8 +601,9 @@ void PPB_ImageData_Proxy::OnHostMsgCreateNaCl( #else #error Not implemented. #endif // defined(OS_WIN) - *result_image_handle = - dispatcher->ShareHandleWithRemote(platform_file, false); + result_image_handle->set_shmem( + dispatcher->ShareHandleWithRemote(platform_file, false), + byte_count); #endif // defined(OS_NACL) } |