| Index: ppapi/proxy/ppb_image_data_proxy.cc
|
| ===================================================================
|
| --- ppapi/proxy/ppb_image_data_proxy.cc (revision 67614)
|
| +++ ppapi/proxy/ppb_image_data_proxy.cc (working copy)
|
| @@ -11,6 +11,7 @@
|
| #include "base/logging.h"
|
| #include "build/build_config.h"
|
| #include "ppapi/c/pp_completion_callback.h"
|
| +#include "ppapi/c/pp_errors.h"
|
| #include "ppapi/c/pp_resource.h"
|
| #include "ppapi/c/ppb_image_data.h"
|
| #include "ppapi/c/trusted/ppb_image_data_trusted.h"
|
| @@ -27,7 +28,7 @@
|
|
|
| class ImageData : public PluginResource {
|
| public:
|
| - ImageData(const PP_ImageDataDesc& desc, uint64_t memory_handle);
|
| + ImageData(const PP_ImageDataDesc& desc, int memory_handle);
|
| virtual ~ImageData();
|
|
|
| // Resource overrides.
|
| @@ -40,7 +41,7 @@
|
|
|
| private:
|
| PP_ImageDataDesc desc_;
|
| - uint64_t memory_handle_;
|
| + int memory_handle_;
|
|
|
| void* mapped_data_;
|
|
|
| @@ -48,7 +49,7 @@
|
| };
|
|
|
| ImageData::ImageData(const PP_ImageDataDesc& desc,
|
| - uint64_t memory_handle)
|
| + int memory_handle)
|
| : desc_(desc),
|
| memory_handle_(memory_handle),
|
| mapped_data_(NULL) {
|
| @@ -61,7 +62,7 @@
|
| void* ImageData::Map() {
|
| #if defined(OS_LINUX)
|
| // On linux, the memory handle is a SysV shared memory segment.
|
| - int shmkey = static_cast<int>(memory_handle_);
|
| + int shmkey = memory_handle_;
|
| void* address = shmat(shmkey, NULL, 0);
|
| // Mark for deletion in case we crash so the kernel will clean it up.
|
| shmctl(shmkey, IPC_RMID, 0);
|
| @@ -110,7 +111,7 @@
|
| PP_Bool init_to_zero) {
|
| PP_Resource result = 0;
|
| std::string image_data_desc;
|
| - uint64_t shm_handle = -1;
|
| + int shm_handle = -1;
|
| PluginDispatcher::Get()->Send(
|
| new PpapiHostMsg_PPBImageData_Create(
|
| INTERFACE_ID_PPB_IMAGE_DATA, module_id, format, *size, init_to_zero,
|
| @@ -210,7 +211,7 @@
|
| PP_Bool init_to_zero,
|
| PP_Resource* result,
|
| std::string* image_data_desc,
|
| - uint64_t* result_shm_handle) {
|
| + int* result_shm_handle) {
|
| *result = ppb_image_data_target()->Create(
|
| module, static_cast<PP_ImageDataFormat>(format), &size, init_to_zero);
|
| *result_shm_handle = 0;
|
| @@ -227,8 +228,11 @@
|
| reinterpret_cast<const PPB_ImageDataTrusted*>(
|
| dispatcher()->GetLocalInterface(PPB_IMAGEDATA_TRUSTED_INTERFACE));
|
| uint32_t byte_count = 0;
|
| - if (trusted)
|
| - *result_shm_handle = trusted->GetNativeMemoryHandle(*result, &byte_count);
|
| + if (trusted) {
|
| + int32_t handle;
|
| + if (trusted->GetSharedMemory(*result, &handle, &byte_count) == PP_OK)
|
| + *result_shm_handle = static_cast<int>(handle);
|
| + }
|
| }
|
| }
|
|
|
|
|