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 2eecc0ffe19972c0a1d4921f2754dda2df14e40c..ea093db8dffd10472f4fa502b35e9b4b34678e13 100644 |
--- a/ppapi/proxy/ppb_image_data_proxy.cc |
+++ b/ppapi/proxy/ppb_image_data_proxy.cc |
@@ -53,7 +53,7 @@ ImageData::ImageData(const HostResource& resource, |
size_(desc.size.width * desc.size.height * 4), |
map_count_(0) { |
} |
-#endif // !defined(OS_NACL) |
+#endif // else, !defined(OS_NACL) |
ImageData::~ImageData() { |
} |
@@ -163,10 +163,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( |
@@ -249,13 +252,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; |
@@ -284,7 +287,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 = |
@@ -295,8 +297,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) |
} |