diff options
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 37 | ||||
-rw-r--r-- | ppapi/proxy/ppb_graphics_2d_proxy.cc | 69 | ||||
-rw-r--r-- | ppapi/proxy/ppb_graphics_2d_proxy.h | 38 | ||||
-rw-r--r-- | ppapi/proxy/ppb_image_data_proxy.cc | 84 | ||||
-rw-r--r-- | ppapi/proxy/ppb_image_data_proxy.h | 30 | ||||
-rw-r--r-- | ppapi/proxy/resource_creation_proxy.cc | 89 | ||||
-rw-r--r-- | ppapi/proxy/resource_creation_proxy.h | 19 | ||||
-rw-r--r-- | ppapi/shared_impl/api_id.h | 1 | ||||
-rw-r--r-- | ppapi/thunk/interfaces_ppb_public_stable.h | 6 |
9 files changed, 197 insertions, 176 deletions
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index c78cf26..d6f0515 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -754,6 +754,11 @@ IPC_SYNC_MESSAGE_CONTROL0_1(PpapiHostMsg_PPBFont_GetFontFamilies, std::string /* result */) // PPB_Graphics2D. +IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBGraphics2D_Create, + PP_Instance /* instance */, + PP_Size /* size */, + PP_Bool /* is_always_opaque */, + ppapi::HostResource /* result */) IPC_MESSAGE_ROUTED5(PpapiHostMsg_PPBGraphics2D_PaintImageData, ppapi::HostResource /* graphics_2d */, ppapi::HostResource /* image_data */, @@ -776,44 +781,46 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBGraphics3D_Create, PP_Instance /* instance */, std::vector<int32_t> /* attrib_list */, ppapi::HostResource /* result */) - IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBGraphics3D_InitCommandBuffer, ppapi::HostResource /* context */, int32 /* size */, base::SharedMemoryHandle /* ring_buffer */) - IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBGraphics3D_GetState, ppapi::HostResource /* context */, gpu::CommandBuffer::State /* state */) - IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBGraphics3D_Flush, ppapi::HostResource /* context */, int32 /* put_offset */, int32 /* last_known_get */, gpu::CommandBuffer::State /* state */) - IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBGraphics3D_AsyncFlush, ppapi::HostResource /* context */, int32 /* put_offset */) - IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBGraphics3D_CreateTransferBuffer, ppapi::HostResource /* context */, int32 /* size */, int32 /* id */) - IPC_SYNC_MESSAGE_ROUTED2_0(PpapiHostMsg_PPBGraphics3D_DestroyTransferBuffer, ppapi::HostResource /* context */, int32 /* id */) - IPC_SYNC_MESSAGE_ROUTED2_2(PpapiHostMsg_PPBGraphics3D_GetTransferBuffer, ppapi::HostResource /* context */, int32 /* id */, base::SharedMemoryHandle /* transfer_buffer */, uint32 /* size */) - IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBGraphics3D_SwapBuffers, ppapi::HostResource /* graphics_3d */) +// PPB_ImageData. +IPC_SYNC_MESSAGE_ROUTED4_3(PpapiHostMsg_PPBImageData_Create, + PP_Instance /* instance */, + int32 /* format */, + PP_Size /* size */, + PP_Bool /* init_to_zero */, + ppapi::HostResource /* result_resource */, + std::string /* image_data_desc */, + ppapi::proxy::ImageHandle /* result */) + // PPB_Instance. IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBInstance_GetWindowObject, PP_Instance /* instance */, @@ -1026,20 +1033,6 @@ IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBVar_CreateObjectDeprecated, int64 /* object_data */, ppapi::proxy::SerializedVar /* result */) -IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_ResourceCreation_Graphics2D, - PP_Instance /* instance */, - PP_Size /* size */, - PP_Bool /* is_always_opaque */, - ppapi::HostResource /* result */) -IPC_SYNC_MESSAGE_ROUTED4_3(PpapiHostMsg_ResourceCreation_ImageData, - PP_Instance /* instance */, - int32 /* format */, - PP_Size /* size */, - PP_Bool /* init_to_zero */, - ppapi::HostResource /* result_resource */, - std::string /* image_data_desc */, - ppapi::proxy::ImageHandle /* result */) - // PPB_VideoCapture_Dev. IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBVideoCapture_Create, PP_Instance /* instance */, diff --git a/ppapi/proxy/ppb_graphics_2d_proxy.cc b/ppapi/proxy/ppb_graphics_2d_proxy.cc index 3b630ea..59659e7 100644 --- a/ppapi/proxy/ppb_graphics_2d_proxy.cc +++ b/ppapi/proxy/ppb_graphics_2d_proxy.cc @@ -52,6 +52,8 @@ class Graphics2D : public Resource, public thunk::PPB_Graphics2D_API { return PluginDispatcher::GetForResource(this); } + static const ApiID kApiID = API_ID_PPB_GRAPHICS_2D; + PP_Size size_; PP_Bool is_always_opaque_; @@ -95,9 +97,8 @@ void Graphics2D::PaintImageData(PP_Resource image_data, PP_Rect dummy; memset(&dummy, 0, sizeof(PP_Rect)); GetDispatcher()->Send(new PpapiHostMsg_PPBGraphics2D_PaintImageData( - API_ID_PPB_GRAPHICS_2D, host_resource(), - image_object->host_resource(), *top_left, !!src_rect, - src_rect ? *src_rect : dummy)); + kApiID, host_resource(), image_object->host_resource(), *top_left, + !!src_rect, src_rect ? *src_rect : dummy)); } void Graphics2D::Scroll(const PP_Rect* clip_rect, @@ -105,8 +106,8 @@ void Graphics2D::Scroll(const PP_Rect* clip_rect, PP_Rect dummy; memset(&dummy, 0, sizeof(PP_Rect)); GetDispatcher()->Send(new PpapiHostMsg_PPBGraphics2D_Scroll( - API_ID_PPB_GRAPHICS_2D, host_resource(), - !!clip_rect, clip_rect ? *clip_rect : dummy, *amount)); + kApiID, host_resource(), !!clip_rect, clip_rect ? *clip_rect : dummy, + *amount)); } void Graphics2D::ReplaceContents(PP_Resource image_data) { @@ -116,8 +117,7 @@ void Graphics2D::ReplaceContents(PP_Resource image_data) { return; GetDispatcher()->Send(new PpapiHostMsg_PPBGraphics2D_ReplaceContents( - API_ID_PPB_GRAPHICS_2D, host_resource(), - image_object->host_resource())); + kApiID, host_resource(), image_object->host_resource())); } int32_t Graphics2D::Flush(PP_CompletionCallback callback) { @@ -130,8 +130,8 @@ int32_t Graphics2D::Flush(PP_CompletionCallback callback) { return PP_ERROR_INPROGRESS; // Can't have >1 flush pending. current_flush_callback_ = callback; - GetDispatcher()->Send(new PpapiHostMsg_PPBGraphics2D_Flush( - API_ID_PPB_GRAPHICS_2D, host_resource())); + GetDispatcher()->Send(new PpapiHostMsg_PPBGraphics2D_Flush(kApiID, + host_resource())); return PP_OK_COMPLETIONPENDING; } @@ -157,9 +157,8 @@ PP_Resource PPB_Graphics2D_Proxy::CreateProxyResource( return 0; HostResource result; - dispatcher->Send(new PpapiHostMsg_ResourceCreation_Graphics2D( - API_ID_RESOURCE_CREATION, instance, size, is_always_opaque, - &result)); + dispatcher->Send(new PpapiHostMsg_PPBGraphics2D_Create( + kApiID, instance, size, is_always_opaque, &result)); if (result.is_null()) return 0; return (new Graphics2D(result, size, is_always_opaque))->GetReference(); @@ -168,24 +167,37 @@ PP_Resource PPB_Graphics2D_Proxy::CreateProxyResource( bool PPB_Graphics2D_Proxy::OnMessageReceived(const IPC::Message& msg) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PPB_Graphics2D_Proxy, msg) + IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_Create, + OnHostMsgCreate) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_PaintImageData, - OnMsgPaintImageData) + OnHostMsgPaintImageData) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_Scroll, - OnMsgScroll) + OnHostMsgScroll) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_ReplaceContents, - OnMsgReplaceContents) + OnHostMsgReplaceContents) IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_Flush, - OnMsgFlush) + OnHostMsgFlush) IPC_MESSAGE_HANDLER(PpapiMsg_PPBGraphics2D_FlushACK, - OnMsgFlushACK) + OnPluginMsgFlushACK) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() // FIXME(brettw) handle bad messages! return handled; } -void PPB_Graphics2D_Proxy::OnMsgPaintImageData( +void PPB_Graphics2D_Proxy::OnHostMsgCreate(PP_Instance instance, + const PP_Size& size, + PP_Bool is_always_opaque, + HostResource* result) { + thunk::EnterResourceCreation enter(instance); + if (enter.succeeded()) { + result->SetHostResource(instance, enter.functions()->CreateGraphics2D( + instance, size, is_always_opaque)); + } +} + +void PPB_Graphics2D_Proxy::OnHostMsgPaintImageData( const HostResource& graphics_2d, const HostResource& image_data, const PP_Point& top_left, @@ -198,17 +210,17 @@ void PPB_Graphics2D_Proxy::OnMsgPaintImageData( src_rect_specified ? &src_rect : NULL); } -void PPB_Graphics2D_Proxy::OnMsgScroll(const HostResource& graphics_2d, - bool clip_specified, - const PP_Rect& clip, - const PP_Point& amount) { +void PPB_Graphics2D_Proxy::OnHostMsgScroll(const HostResource& graphics_2d, + bool clip_specified, + const PP_Rect& clip, + const PP_Point& amount) { EnterHostFromHostResource<PPB_Graphics2D_API> enter(graphics_2d); if (enter.failed()) return; enter.object()->Scroll(clip_specified ? &clip : NULL, &amount); } -void PPB_Graphics2D_Proxy::OnMsgReplaceContents( +void PPB_Graphics2D_Proxy::OnHostMsgReplaceContents( const HostResource& graphics_2d, const HostResource& image_data) { EnterHostFromHostResource<PPB_Graphics2D_API> enter(graphics_2d); @@ -217,7 +229,7 @@ void PPB_Graphics2D_Proxy::OnMsgReplaceContents( enter.object()->ReplaceContents(image_data.host_resource()); } -void PPB_Graphics2D_Proxy::OnMsgFlush(const HostResource& graphics_2d) { +void PPB_Graphics2D_Proxy::OnHostMsgFlush(const HostResource& graphics_2d) { EnterHostFromHostResourceForceCallback<PPB_Graphics2D_API> enter( graphics_2d, callback_factory_, &PPB_Graphics2D_Proxy::SendFlushACKToPlugin, graphics_2d); @@ -226,8 +238,9 @@ void PPB_Graphics2D_Proxy::OnMsgFlush(const HostResource& graphics_2d) { enter.SetResult(enter.object()->Flush(enter.callback())); } -void PPB_Graphics2D_Proxy::OnMsgFlushACK(const HostResource& host_resource, - int32_t pp_error) { +void PPB_Graphics2D_Proxy::OnPluginMsgFlushACK( + const HostResource& host_resource, + int32_t pp_error) { EnterPluginFromHostResource<PPB_Graphics2D_API> enter(host_resource); if (enter.succeeded()) static_cast<Graphics2D*>(enter.object())->FlushACK(pp_error); @@ -236,8 +249,8 @@ void PPB_Graphics2D_Proxy::OnMsgFlushACK(const HostResource& host_resource, void PPB_Graphics2D_Proxy::SendFlushACKToPlugin( int32_t result, const HostResource& graphics_2d) { - dispatcher()->Send(new PpapiMsg_PPBGraphics2D_FlushACK( - API_ID_PPB_GRAPHICS_2D, graphics_2d, result)); + dispatcher()->Send(new PpapiMsg_PPBGraphics2D_FlushACK(kApiID, graphics_2d, + result)); } } // namespace proxy diff --git a/ppapi/proxy/ppb_graphics_2d_proxy.h b/ppapi/proxy/ppb_graphics_2d_proxy.h index c872871c..2897595 100644 --- a/ppapi/proxy/ppb_graphics_2d_proxy.h +++ b/ppapi/proxy/ppb_graphics_2d_proxy.h @@ -39,27 +39,31 @@ class PPB_Graphics2D_Proxy : public InterfaceProxy { static const ApiID kApiID = API_ID_PPB_GRAPHICS_2D; private: - // Plugin->renderer message handlers. - void OnMsgPaintImageData(const ppapi::HostResource& graphics_2d, - const ppapi::HostResource& image_data, - const PP_Point& top_left, - bool src_rect_specified, - const PP_Rect& src_rect); - void OnMsgScroll(const ppapi::HostResource& graphics_2d, - bool clip_specified, - const PP_Rect& clip, - const PP_Point& amount); - void OnMsgReplaceContents(const ppapi::HostResource& graphics_2d, - const ppapi::HostResource& image_data); - void OnMsgFlush(const ppapi::HostResource& graphics_2d); + // Plugin->host message handlers. + void OnHostMsgCreate(PP_Instance instance, + const PP_Size& size, + PP_Bool is_always_opaque, + HostResource* result); + void OnHostMsgPaintImageData(const HostResource& graphics_2d, + const HostResource& image_data, + const PP_Point& top_left, + bool src_rect_specified, + const PP_Rect& src_rect); + void OnHostMsgScroll(const HostResource& graphics_2d, + bool clip_specified, + const PP_Rect& clip, + const PP_Point& amount); + void OnHostMsgReplaceContents(const HostResource& graphics_2d, + const HostResource& image_data); + void OnHostMsgFlush(const HostResource& graphics_2d); - // Renderer->plugin message handlers. - void OnMsgFlushACK(const ppapi::HostResource& graphics_2d, - int32_t pp_error); + // Host->plugin message handlers. + void OnPluginMsgFlushACK(const HostResource& graphics_2d, + int32_t pp_error); // Called in the renderer to send the given flush ACK to the plugin. void SendFlushACKToPlugin(int32_t result, - const ppapi::HostResource& graphics_2d); + const HostResource& graphics_2d); pp::CompletionCallbackFactory<PPB_Graphics2D_Proxy, ProxyNonThreadSafeRefCount> callback_factory_; diff --git a/ppapi/proxy/ppb_image_data_proxy.cc b/ppapi/proxy/ppb_image_data_proxy.cc index 32c24a9..20f8f62 100644 --- a/ppapi/proxy/ppb_image_data_proxy.cc +++ b/ppapi/proxy/ppb_image_data_proxy.cc @@ -18,6 +18,7 @@ #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/shared_impl/host_resource.h" #include "ppapi/shared_impl/resource.h" +#include "ppapi/thunk/enter.h" #include "ppapi/thunk/thunk.h" #include "skia/ext/platform_canvas.h" #include "ui/gfx/surface/transport_dib.h" @@ -94,5 +95,88 @@ ImageHandle ImageData::HandleFromInt(int32_t i) { #endif } +PPB_ImageData_Proxy::PPB_ImageData_Proxy(Dispatcher* dispatcher) + : InterfaceProxy(dispatcher) { +} + +PPB_ImageData_Proxy::~PPB_ImageData_Proxy() { +} + +// static +PP_Resource PPB_ImageData_Proxy::CreateProxyResource(PP_Instance instance, + PP_ImageDataFormat format, + const PP_Size& size, + PP_Bool init_to_zero) { + PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); + if (!dispatcher) + return 0; + + HostResource result; + std::string image_data_desc; + ImageHandle image_handle = ImageData::NullHandle; + dispatcher->Send(new PpapiHostMsg_PPBImageData_Create( + kApiID, instance, format, size, init_to_zero, + &result, &image_data_desc, &image_handle)); + + if (result.is_null() || image_data_desc.size() != sizeof(PP_ImageDataDesc)) + return 0; + + // We serialize the PP_ImageDataDesc just by copying to a string. + PP_ImageDataDesc desc; + memcpy(&desc, image_data_desc.data(), sizeof(PP_ImageDataDesc)); + + return (new ImageData(result, desc, image_handle))->GetReference(); +} + +bool PPB_ImageData_Proxy::OnMessageReceived(const IPC::Message& msg) { + bool handled = true; + IPC_BEGIN_MESSAGE_MAP(PPB_ImageData_Proxy, msg) + IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_Create, OnHostMsgCreate) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + return handled; +} + +void PPB_ImageData_Proxy::OnHostMsgCreate(PP_Instance instance, + int32_t format, + const PP_Size& size, + PP_Bool init_to_zero, + HostResource* result, + std::string* image_data_desc, + ImageHandle* result_image_handle) { + *result_image_handle = ImageData::NullHandle; + + thunk::EnterResourceCreation enter(instance); + if (enter.failed()) + return; + + PP_Resource resource = enter.functions()->CreateImageData( + instance, static_cast<PP_ImageDataFormat>(format), size, init_to_zero); + if (!resource) + return; + result->SetHostResource(instance, resource); + + // Get the description, it's just serialized as a string. + thunk::EnterResourceNoLock<thunk::PPB_ImageData_API> enter_resource( + resource, false); + PP_ImageDataDesc desc; + if (enter_resource.object()->Describe(&desc) == PP_TRUE) { + image_data_desc->resize(sizeof(PP_ImageDataDesc)); + memcpy(&(*image_data_desc)[0], &desc, sizeof(PP_ImageDataDesc)); + } + + // Get the shared memory handle. + uint32_t byte_count = 0; + int32_t handle = 0; + if (enter_resource.object()->GetSharedMemory(&handle, &byte_count) == PP_OK) { +#if defined(OS_WIN) + ImageHandle ih = ImageData::HandleFromInt(handle); + *result_image_handle = dispatcher()->ShareHandleWithRemote(ih, false); +#else + *result_image_handle = ImageData::HandleFromInt(handle); +#endif + } +} + } // namespace proxy } // namespace ppapi diff --git a/ppapi/proxy/ppb_image_data_proxy.h b/ppapi/proxy/ppb_image_data_proxy.h index bf9b33b..9250948 100644 --- a/ppapi/proxy/ppb_image_data_proxy.h +++ b/ppapi/proxy/ppb_image_data_proxy.h @@ -32,6 +32,8 @@ class HostResource; namespace proxy { +// The proxied image data resource. Unlike most resources, this needs to be +// public in the header since a number of other resources need to access it. class ImageData : public ppapi::Resource, public ppapi::thunk::PPB_ImageData_API, public ppapi::ImageDataImpl { @@ -68,6 +70,34 @@ class ImageData : public ppapi::Resource, DISALLOW_COPY_AND_ASSIGN(ImageData); }; +class PPB_ImageData_Proxy : public InterfaceProxy { + public: + PPB_ImageData_Proxy(Dispatcher* dispatcher); + virtual ~PPB_ImageData_Proxy(); + + static PP_Resource CreateProxyResource(PP_Instance instance, + PP_ImageDataFormat format, + const PP_Size& size, + PP_Bool init_to_zero); + + // InterfaceProxy implementation. + virtual bool OnMessageReceived(const IPC::Message& msg); + + static const ApiID kApiID = API_ID_PPB_IMAGE_DATA; + + private: + // Message handler. + void OnHostMsgCreate(PP_Instance instance, + int32_t format, + const PP_Size& size, + PP_Bool init_to_zero, + HostResource* result, + std::string* image_data_desc, + ImageHandle* result_image_handle); + + DISALLOW_COPY_AND_ASSIGN(PPB_ImageData_Proxy); +}; + } // namespace proxy } // namespace ppapi diff --git a/ppapi/proxy/resource_creation_proxy.cc b/ppapi/proxy/resource_creation_proxy.cc index 77936c4..0a0846e 100644 --- a/ppapi/proxy/resource_creation_proxy.cc +++ b/ppapi/proxy/resource_creation_proxy.cc @@ -168,25 +168,8 @@ PP_Resource ResourceCreationProxy::CreateImageData(PP_Instance instance, PP_ImageDataFormat format, const PP_Size& size, PP_Bool init_to_zero) { - PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); - if (!dispatcher) - return 0; - - HostResource result; - std::string image_data_desc; - ImageHandle image_handle = ImageData::NullHandle; - dispatcher->Send(new PpapiHostMsg_ResourceCreation_ImageData( - API_ID_RESOURCE_CREATION, instance, format, size, init_to_zero, - &result, &image_data_desc, &image_handle)); - - if (result.is_null() || image_data_desc.size() != sizeof(PP_ImageDataDesc)) - return 0; - - // We serialize the PP_ImageDataDesc just by copying to a string. - PP_ImageDataDesc desc; - memcpy(&desc, image_data_desc.data(), sizeof(PP_ImageDataDesc)); - - return (new ImageData(result, desc, image_handle))->GetReference(); + return PPB_ImageData_Proxy::CreateProxyResource(instance, format, size, + init_to_zero); } PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent( @@ -345,73 +328,7 @@ bool ResourceCreationProxy::Send(IPC::Message* msg) { } bool ResourceCreationProxy::OnMessageReceived(const IPC::Message& msg) { - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(ResourceCreationProxy, msg) - IPC_MESSAGE_HANDLER(PpapiHostMsg_ResourceCreation_Graphics2D, - OnMsgCreateGraphics2D) - IPC_MESSAGE_HANDLER(PpapiHostMsg_ResourceCreation_ImageData, - OnMsgCreateImageData) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - return handled; -} - -void ResourceCreationProxy::OnMsgCreateGraphics2D(PP_Instance instance, - const PP_Size& size, - PP_Bool is_always_opaque, - HostResource* result) { - ppapi::thunk::EnterFunction<ResourceCreationAPI> enter(instance, false); - if (enter.succeeded()) { - result->SetHostResource(instance, enter.functions()->CreateGraphics2D( - instance, size, is_always_opaque)); - } -} - -void ResourceCreationProxy::OnMsgCreateImageData( - PP_Instance instance, - int32_t format, - const PP_Size& size, - PP_Bool init_to_zero, - HostResource* result, - std::string* image_data_desc, - ImageHandle* result_image_handle) { - *result_image_handle = ImageData::NullHandle; - - ppapi::thunk::EnterFunction<ResourceCreationAPI> enter(instance, false); - if (enter.failed()) - return; - - PP_Resource resource = enter.functions()->CreateImageData( - instance, static_cast<PP_ImageDataFormat>(format), size, init_to_zero); - if (!resource) - return; - result->SetHostResource(instance, resource); - - // Get the description, it's just serialized as a string. - ppapi::thunk::EnterResourceNoLock<ppapi::thunk::PPB_ImageData_API> - enter_resource(resource, false); - PP_ImageDataDesc desc; - if (enter_resource.object()->Describe(&desc) == PP_TRUE) { - image_data_desc->resize(sizeof(PP_ImageDataDesc)); - memcpy(&(*image_data_desc)[0], &desc, sizeof(PP_ImageDataDesc)); - } - - // Get the shared memory handle. - const PPB_ImageDataTrusted* trusted = - reinterpret_cast<const PPB_ImageDataTrusted*>( - dispatcher()->local_get_interface()(PPB_IMAGEDATA_TRUSTED_INTERFACE)); - uint32_t byte_count = 0; - if (trusted) { - int32_t handle; - if (trusted->GetSharedMemory(resource, &handle, &byte_count) == PP_OK) { -#if defined(OS_WIN) - ImageHandle ih = ImageData::HandleFromInt(handle); - *result_image_handle = dispatcher()->ShareHandleWithRemote(ih, false); -#else - *result_image_handle = ImageData::HandleFromInt(handle); -#endif - } - } + return false; } } // namespace proxy diff --git a/ppapi/proxy/resource_creation_proxy.h b/ppapi/proxy/resource_creation_proxy.h index 5d3eb66..da269e9 100644 --- a/ppapi/proxy/resource_creation_proxy.h +++ b/ppapi/proxy/resource_creation_proxy.h @@ -131,25 +131,6 @@ class ResourceCreationProxy : public InterfaceProxy, virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; private: - // IPC message handlers (called in browser). - void OnMsgCreateAudio(PP_Instance instance, - int32_t sample_rate, - uint32_t sample_frame_count, - HostResource* result); - void OnMsgCreateAudioInput(PP_Instance instance, - HostResource* result); - void OnMsgCreateGraphics2D(PP_Instance instance, - const PP_Size& size, - PP_Bool is_always_opaque, - HostResource* result); - void OnMsgCreateImageData(PP_Instance instance, - int32_t format, - const PP_Size& size, - PP_Bool init_to_zero, - HostResource* result, - std::string* image_data_desc, - ImageHandle* result_image_handle); - DISALLOW_COPY_AND_ASSIGN(ResourceCreationProxy); }; diff --git a/ppapi/shared_impl/api_id.h b/ppapi/shared_impl/api_id.h index 5da4b04..c8c9362 100644 --- a/ppapi/shared_impl/api_id.h +++ b/ppapi/shared_impl/api_id.h @@ -32,6 +32,7 @@ enum ApiID { API_ID_PPB_FONT, API_ID_PPB_GRAPHICS_2D, API_ID_PPB_GRAPHICS_3D, + API_ID_PPB_IMAGE_DATA, API_ID_PPB_INSTANCE, API_ID_PPB_INSTANCE_PRIVATE, API_ID_PPB_OPENGLES2, diff --git a/ppapi/thunk/interfaces_ppb_public_stable.h b/ppapi/thunk/interfaces_ppb_public_stable.h index 1a91038..b81f744 100644 --- a/ppapi/thunk/interfaces_ppb_public_stable.h +++ b/ppapi/thunk/interfaces_ppb_public_stable.h @@ -26,7 +26,7 @@ UNPROXIED_API(PPB_FileIO) PROXIED_API(PPB_FileRef) PROXIED_API(PPB_FileSystem) PROXIED_API(PPB_Graphics2D) -UNPROXIED_API(PPB_ImageData) +PROXIED_API(PPB_ImageData) PROXIED_API(PPB_Instance) PROXIED_API(PPB_URLLoader) PROXIED_API(PPB_URLResponseInfo) @@ -55,9 +55,7 @@ PROXIED_IFACE(PPB_FileRef, PPB_FILEREF_INTERFACE_1_0, PPB_FileRef) PROXIED_IFACE(PPB_FileSystem, PPB_FILESYSTEM_INTERFACE_1_0, PPB_FileSystem) PROXIED_IFACE(PPB_Graphics2D, PPB_GRAPHICS_2D_INTERFACE_1_0, PPB_Graphics2D) PROXIED_IFACE(PPB_Graphics3D, PPB_GRAPHICS_3D_INTERFACE_1_0, PPB_Graphics3D) -// ImageData doesn't have a normal _Proxy object since it only uses Create -// to proxy, and that happens in the ResourceCreationAPI. -PROXIED_IFACE(NoAPIName, PPB_IMAGEDATA_INTERFACE_1_0, PPB_ImageData) +PROXIED_IFACE(PPB_ImageData, PPB_IMAGEDATA_INTERFACE_1_0, PPB_ImageData) PROXIED_IFACE(PPB_Instance, PPB_INSTANCE_INTERFACE_1_0, PPB_Instance) PROXIED_IFACE(NoAPIName, PPB_INPUT_EVENT_INTERFACE_1_0, PPB_InputEvent) PROXIED_IFACE(NoAPIName, PPB_KEYBOARD_INPUT_EVENT_INTERFACE_1_0, |