Index: ppapi/proxy/ppb_instance_proxy.cc |
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc |
index fb71a93297d9c215dcff599c01c9a5c3bd165eb6..41c5e2323e413db9658af70c42725062d4ae1443 100644 |
--- a/ppapi/proxy/ppb_instance_proxy.cc |
+++ b/ppapi/proxy/ppb_instance_proxy.cc |
@@ -28,6 +28,8 @@ |
#include "ppapi/shared_impl/ppb_view_shared.h" |
#include "ppapi/shared_impl/var.h" |
#include "ppapi/thunk/enter.h" |
+#include "ppapi/thunk/ppb_graphics_2d_api.h" |
+#include "ppapi/thunk/ppb_graphics_3d_api.h" |
#include "ppapi/thunk/thunk.h" |
// Windows headers interfere with this file. |
@@ -37,6 +39,8 @@ |
using ppapi::thunk::EnterInstanceNoLock; |
using ppapi::thunk::EnterResourceNoLock; |
+using ppapi::thunk::PPB_Graphics2D_API; |
+using ppapi::thunk::PPB_Graphics3D_API; |
using ppapi::thunk::PPB_Instance_API; |
namespace ppapi { |
@@ -196,9 +200,20 @@ PP_Bool PPB_Instance_Proxy::BindGraphics(PP_Instance instance, |
return PP_FALSE; |
PP_Bool result = PP_FALSE; |
- dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics( |
- API_ID_PPB_INSTANCE, instance, object->host_resource(), |
- &result)); |
+ |
+ // We need to pass different resource to Graphics 2D and 3D right now. Once |
+ // 3D is migrated to the new design, we should be able to unify this. |
+ EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false); |
+ EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false); |
+ if (enter_2d.succeeded()) { |
+ dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics( |
+ API_ID_PPB_INSTANCE, instance, object->pp_resource(), |
+ &result)); |
+ } else if (enter_3d.succeeded()) { |
+ dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics( |
+ API_ID_PPB_INSTANCE, instance, object->host_resource().host_resource(), |
+ &result)); |
+ } |
return result; |
} |
@@ -752,12 +767,11 @@ void PPB_Instance_Proxy::OnHostMsgGetOwnerElementObject( |
} |
void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance, |
- const HostResource& device, |
+ PP_Resource device, |
PP_Bool* result) { |
EnterInstanceNoLock enter(instance); |
if (enter.succeeded()) { |
- *result = enter.functions()->BindGraphics(instance, |
- device.host_resource()); |
+ *result = enter.functions()->BindGraphics(instance, device); |
} |
} |