summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/ppb_instance_proxy.cc
diff options
context:
space:
mode:
authorbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 00:56:41 +0000
committerbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 00:56:41 +0000
commit5c0dfaa04fb0c451eb91801acdd9320248fefcb9 (patch)
tree940b521036b591a47d8fb62a87a33a7aaf6da8ee /ppapi/proxy/ppb_instance_proxy.cc
parente69a42ac3bd9e0b8c71b1e03f07502a7e509ae66 (diff)
downloadchromium_src-5c0dfaa04fb0c451eb91801acdd9320248fefcb9.zip
chromium_src-5c0dfaa04fb0c451eb91801acdd9320248fefcb9.tar.gz
chromium_src-5c0dfaa04fb0c451eb91801acdd9320248fefcb9.tar.bz2
Fix the PPAPI out of process proxy PPB_Instance::BindGraphics function.
When 'device' == 0, unbind all devices. Send a null HostResource instead of failing. BUG=116317 TEST=nacl_integration Review URL: https://chromiumcodereview.appspot.com/11365049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165579 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_instance_proxy.cc')
-rw-r--r--ppapi/proxy/ppb_instance_proxy.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc
index 836117f..90a33f4 100644
--- a/ppapi/proxy/ppb_instance_proxy.cc
+++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -191,15 +191,20 @@ bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) {
PP_Bool PPB_Instance_Proxy::BindGraphics(PP_Instance instance,
PP_Resource device) {
- Resource* object =
- PpapiGlobals::Get()->GetResourceTracker()->GetResource(device);
- if (!object || object->pp_instance() != instance)
- return PP_FALSE;
+ // If device is 0, pass a null HostResource. This signals the host to unbind
+ // all devices.
+ HostResource host_resource;
+ if (device) {
+ Resource* resource =
+ PpapiGlobals::Get()->GetResourceTracker()->GetResource(device);
+ if (!resource || resource->pp_instance() != instance)
+ return PP_FALSE;
+ host_resource = resource->host_resource();
+ }
PP_Bool result = PP_FALSE;
dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
- API_ID_PPB_INSTANCE, instance, object->host_resource(),
- &result));
+ API_ID_PPB_INSTANCE, instance, host_resource, &result));
return result;
}