Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: ppapi/proxy/ppb_image_data_proxy.cc

Issue 10828023: PPAPI/NaCl: Make NaClIPCAdapter transfer handles more generally (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-add gyp files Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/ppb_image_data_proxy.h ('k') | ppapi/proxy/serialized_structs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_image_data_proxy.cc
diff --git a/ppapi/proxy/ppb_image_data_proxy.cc b/ppapi/proxy/ppb_image_data_proxy.cc
index d7c621d57fbfc4e7f3410e58a770216c3c67e752..eca97490412d4d55c264821b30ae745025c22903 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)
}
« no previous file with comments | « ppapi/proxy/ppb_image_data_proxy.h ('k') | ppapi/proxy/serialized_structs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698