summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbbudge <bbudge@chromium.org>2015-05-08 20:04:04 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-09 03:04:41 +0000
commit5a6423de4b6032c0b419ac943895aa4441c09363 (patch)
tree20e5bc8be2861f3d738c7e6cfd3ea6a6295a5a69
parentc80637399c13d7c3e8cb7a16bd5de104feb449e9 (diff)
downloadchromium_src-5a6423de4b6032c0b419ac943895aa4441c09363.zip
chromium_src-5a6423de4b6032c0b419ac943895aa4441c09363.tar.gz
chromium_src-5a6423de4b6032c0b419ac943895aa4441c09363.tar.bz2
Pepper: Make PepperUDPSocketBase work with the private UDP resource.
This changes PepperUDPSocketBase::SlotBecameAvailable to attempt to enter both the public and private APIs before failing. BUG=481894 Review URL: https://codereview.chromium.org/1133863002 Cr-Commit-Position: refs/heads/master@{#329033}
-rw-r--r--ppapi/proxy/udp_socket_resource_base.cc16
1 files changed, 12 insertions, 4 deletions
diff --git a/ppapi/proxy/udp_socket_resource_base.cc b/ppapi/proxy/udp_socket_resource_base.cc
index ed231f8..795b63b 100644
--- a/ppapi/proxy/udp_socket_resource_base.cc
+++ b/ppapi/proxy/udp_socket_resource_base.cc
@@ -304,12 +304,20 @@ void UDPSocketResourceBase::OnPluginMsgSendToReply(
// static
void UDPSocketResourceBase::SlotBecameAvailable(PP_Resource resource) {
ProxyLock::AssertAcquired();
+ UDPSocketResourceBase* thiz = nullptr;
+ // We have to try to enter all subclasses of UDPSocketResourceBase. Currently,
+ // these are the public and private resources.
thunk::EnterResourceNoLock<thunk::PPB_UDPSocket_API> enter(resource, false);
- if (enter.failed())
- return;
- auto thiz(static_cast<UDPSocketResourceBase*>(enter.resource()));
+ if (enter.succeeded()) {
+ thiz = static_cast<UDPSocketResourceBase*>(enter.resource());
+ } else {
+ thunk::EnterResourceNoLock<thunk::PPB_UDPSocket_Private_API> enter_private(
+ resource, false);
+ if (enter_private.succeeded())
+ thiz = static_cast<UDPSocketResourceBase*>(enter_private.resource());
+ }
- if (!thiz->closed_)
+ if (thiz && !thiz->closed_)
thiz->Post(BROWSER, PpapiHostMsg_UDPSocket_RecvSlotAvailable());
}