From 5a6423de4b6032c0b419ac943895aa4441c09363 Mon Sep 17 00:00:00 2001 From: bbudge Date: Fri, 8 May 2015 20:04:04 -0700 Subject: [PATCH] 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} --- ppapi/proxy/udp_socket_resource_base.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ppapi/proxy/udp_socket_resource_base.cc b/ppapi/proxy/udp_socket_resource_base.cc index ed231f8f6b3f..795b63b40409 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 enter(resource, false); - if (enter.failed()) - return; - auto thiz(static_cast(enter.resource())); + if (enter.succeeded()) { + thiz = static_cast(enter.resource()); + } else { + thunk::EnterResourceNoLock enter_private( + resource, false); + if (enter_private.succeeded()) + thiz = static_cast(enter_private.resource()); + } - if (!thiz->closed_) + if (thiz && !thiz->closed_) thiz->Post(BROWSER, PpapiHostMsg_UDPSocket_RecvSlotAvailable()); } -- 2.11.4.GIT