diff options
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 9 | ||||
-rw-r--r-- | ppapi/proxy/udp_socket_private_resource.cc | 26 | ||||
-rw-r--r-- | ppapi/proxy/udp_socket_private_resource.h | 3 |
3 files changed, 17 insertions, 21 deletions
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index afe63e3..1019514 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -1222,15 +1222,12 @@ IPC_MESSAGE_CONTROL2(PpapiHostMsg_UDPSocketPrivate_SendTo, std::string /* data */, PP_NetAddress_Private /* net_addr */) IPC_MESSAGE_CONTROL0(PpapiHostMsg_UDPSocketPrivate_Close) -IPC_MESSAGE_CONTROL2(PpapiPluginMsg_UDPSocketPrivate_BindReply, - bool /* succeeded */, +IPC_MESSAGE_CONTROL1(PpapiPluginMsg_UDPSocketPrivate_BindReply, PP_NetAddress_Private /* bound_addr */) -IPC_MESSAGE_CONTROL3(PpapiPluginMsg_UDPSocketPrivate_RecvFromReply, - bool /* succeeded */, +IPC_MESSAGE_CONTROL2(PpapiPluginMsg_UDPSocketPrivate_RecvFromReply, std::string /* data */, PP_NetAddress_Private /* remote_addr */) -IPC_MESSAGE_CONTROL2(PpapiPluginMsg_UDPSocketPrivate_SendToReply, - bool /* succeeded */, +IPC_MESSAGE_CONTROL1(PpapiPluginMsg_UDPSocketPrivate_SendToReply, int32_t /* bytes_written */) // PPB_TCPServerSocket_Private. diff --git a/ppapi/proxy/udp_socket_private_resource.cc b/ppapi/proxy/udp_socket_private_resource.cc index 5469f30..608fc00 100644 --- a/ppapi/proxy/udp_socket_private_resource.cc +++ b/ppapi/proxy/udp_socket_private_resource.cc @@ -77,7 +77,7 @@ int32_t UDPSocketPrivateResource::Bind( bind_callback_ = callback; - // Send the request, the browser will call us back via BindACK. + // Send the request, the browser will call us back via BindReply. SendBind(*addr); return PP_OK_COMPLETIONPENDING; } @@ -105,7 +105,7 @@ int32_t UDPSocketPrivateResource::RecvFrom( bytes_to_read_ = std::min(num_bytes, kMaxReadSize); recvfrom_callback_ = callback; - // Send the request, the browser will call us back via RecvFromACK. + // Send the request, the browser will call us back via RecvFromReply. SendRecvFrom(bytes_to_read_); return PP_OK_COMPLETIONPENDING; } @@ -141,7 +141,7 @@ int32_t UDPSocketPrivateResource::SendTo( sendto_callback_ = callback; - // Send the request, the browser will call us back via SendToACK. + // Send the request, the browser will call us back via SendToReply. SendSendTo(std::string(buffer, num_bytes), *addr); return PP_OK_COMPLETIONPENDING; } @@ -200,27 +200,26 @@ void UDPSocketPrivateResource::SendClose() { void UDPSocketPrivateResource::OnPluginMsgBindReply( const ResourceMessageReplyParams& params, - bool succeeded, const PP_NetAddress_Private& bound_addr) { if (!TrackedCallback::IsPending(bind_callback_)) { NOTREACHED(); return; } - if (succeeded) + if (params.result() == PP_OK) bound_ = true; bound_addr_ = bound_addr; - bind_callback_->Run(succeeded ? PP_OK : PP_ERROR_FAILED); + bind_callback_->Run(params.result()); } void UDPSocketPrivateResource::OnPluginMsgRecvFromReply( const ResourceMessageReplyParams& params, - bool succeeded, const std::string& data, const PP_NetAddress_Private& addr) { if (!TrackedCallback::IsPending(recvfrom_callback_) || !read_buffer_) { NOTREACHED(); return; } + bool succeeded = (params.result() == PP_OK); if (succeeded) { CHECK_LE(static_cast<int32_t>(data.size()), bytes_to_read_); if (!data.empty()) @@ -230,20 +229,23 @@ void UDPSocketPrivateResource::OnPluginMsgRecvFromReply( bytes_to_read_ = -1; recvfrom_addr_ = addr; - recvfrom_callback_->Run(succeeded ? static_cast<int32_t>(data.size()) : - static_cast<int32_t>(PP_ERROR_FAILED)); + if (succeeded) + recvfrom_callback_->Run(static_cast<int32_t>(data.size())); + else + recvfrom_callback_->Run(params.result()); } void UDPSocketPrivateResource::OnPluginMsgSendToReply( const ResourceMessageReplyParams& params, - bool succeeded, int32_t bytes_written) { if (!TrackedCallback::IsPending(sendto_callback_)) { NOTREACHED(); return; } - sendto_callback_->Run( - succeeded ? bytes_written : static_cast<int32_t>(PP_ERROR_FAILED)); + if (params.result() == PP_OK) + sendto_callback_->Run(bytes_written); + else + sendto_callback_->Run(params.result()); } } // namespace proxy diff --git a/ppapi/proxy/udp_socket_private_resource.h b/ppapi/proxy/udp_socket_private_resource.h index d49e085..6403f6b 100644 --- a/ppapi/proxy/udp_socket_private_resource.h +++ b/ppapi/proxy/udp_socket_private_resource.h @@ -62,14 +62,11 @@ class PPAPI_PROXY_EXPORT UDPSocketPrivateResource // IPC message handlers. void OnPluginMsgBindReply(const ResourceMessageReplyParams& params, - bool succeeded, const PP_NetAddress_Private& bound_addr); void OnPluginMsgRecvFromReply(const ResourceMessageReplyParams& params, - bool succeeded, const std::string& data, const PP_NetAddress_Private& addr); void OnPluginMsgSendToReply(const ResourceMessageReplyParams& params, - bool succeeded, int32_t bytes_written); bool bound_; |