| Index: content/browser/renderer_host/pepper/pepper_udp_socket_message_filter.cc
|
| diff --git a/content/browser/renderer_host/pepper/pepper_udp_socket_message_filter.cc b/content/browser/renderer_host/pepper/pepper_udp_socket_message_filter.cc
|
| index 38e2bc283a3974655e791510c4b4676f9d162667..dd177131a6f642dbd959179ca71bc7f2caeb0ab1 100644
|
| --- a/content/browser/renderer_host/pepper/pepper_udp_socket_message_filter.cc
|
| +++ b/content/browser/renderer_host/pepper/pepper_udp_socket_message_filter.cc
|
| @@ -27,12 +27,14 @@
|
| #include "ppapi/host/ppapi_host.h"
|
| #include "ppapi/host/resource_host.h"
|
| #include "ppapi/proxy/ppapi_messages.h"
|
| +#include "ppapi/proxy/udp_socket_filter.h"
|
| #include "ppapi/proxy/udp_socket_resource_base.h"
|
| #include "ppapi/shared_impl/private/net_address_private_impl.h"
|
| #include "ppapi/shared_impl/socket_option_data.h"
|
|
|
| using ppapi::NetAddressPrivateImpl;
|
| using ppapi::host::NetErrorToPepperError;
|
| +using ppapi::proxy::UDPSocketFilter;
|
| using ppapi::proxy::UDPSocketResourceBase;
|
|
|
| namespace {
|
| @@ -64,7 +66,7 @@ PepperUDPSocketMessageFilter::PepperUDPSocketMessageFilter(
|
| multicast_ttl_(0),
|
| can_use_multicast_(PP_ERROR_FAILED),
|
| closed_(false),
|
| - remaining_recv_slots_(UDPSocketResourceBase::kPluginReceiveBufferSlots),
|
| + remaining_recv_slots_(UDPSocketFilter::kPluginReceiveBufferSlots),
|
| external_plugin_(host->external_plugin()),
|
| private_api_(private_api),
|
| render_process_id_(0),
|
| @@ -174,10 +176,8 @@ int32_t PepperUDPSocketMessageFilter::OnMsgSetOption(
|
| }
|
| case PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE: {
|
| int32_t integer_value = 0;
|
| - if (!value.GetInt32(&integer_value) ||
|
| - integer_value <= 0 ||
|
| - integer_value >
|
| - ppapi::proxy::UDPSocketResourceBase::kMaxSendBufferSize)
|
| + if (!value.GetInt32(&integer_value) || integer_value <= 0 ||
|
| + integer_value > UDPSocketResourceBase::kMaxSendBufferSize)
|
| return PP_ERROR_BADARGUMENT;
|
|
|
| // If the socket is already bound, proxy the value to UDPSocket.
|
| @@ -193,10 +193,8 @@ int32_t PepperUDPSocketMessageFilter::OnMsgSetOption(
|
| }
|
| case PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE: {
|
| int32_t integer_value = 0;
|
| - if (!value.GetInt32(&integer_value) ||
|
| - integer_value <= 0 ||
|
| - integer_value >
|
| - ppapi::proxy::UDPSocketResourceBase::kMaxReceiveBufferSize)
|
| + if (!value.GetInt32(&integer_value) || integer_value <= 0 ||
|
| + integer_value > UDPSocketFilter::kMaxReceiveBufferSize)
|
| return PP_ERROR_BADARGUMENT;
|
|
|
| // If the socket is already bound, proxy the value to UDPSocket.
|
| @@ -330,8 +328,7 @@ int32_t PepperUDPSocketMessageFilter::OnMsgRecvSlotAvailable(
|
| const ppapi::host::HostMessageContext* context) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
|
|
| - if (remaining_recv_slots_ <
|
| - UDPSocketResourceBase::kPluginReceiveBufferSlots) {
|
| + if (remaining_recv_slots_ < UDPSocketFilter::kPluginReceiveBufferSlots) {
|
| remaining_recv_slots_++;
|
| }
|
|
|
| @@ -504,7 +501,7 @@ void PepperUDPSocketMessageFilter::DoRecvFrom() {
|
| DCHECK(!recvfrom_buffer_.get());
|
| DCHECK_GT(remaining_recv_slots_, 0u);
|
|
|
| - recvfrom_buffer_ = new net::IOBuffer(UDPSocketResourceBase::kMaxReadSize);
|
| + recvfrom_buffer_ = new net::IOBuffer(UDPSocketFilter::kMaxReadSize);
|
|
|
| // Use base::Unretained(this), so that the lifespan of this object doesn't
|
| // have to last until the callback is called.
|
| @@ -512,9 +509,7 @@ void PepperUDPSocketMessageFilter::DoRecvFrom() {
|
| // object gets destroyed (and so does |socket_|), the callback won't be
|
| // called.
|
| int net_result = socket_->RecvFrom(
|
| - recvfrom_buffer_.get(),
|
| - UDPSocketResourceBase::kMaxReadSize,
|
| - &recvfrom_address_,
|
| + recvfrom_buffer_.get(), UDPSocketFilter::kMaxReadSize, &recvfrom_address_,
|
| base::Bind(&PepperUDPSocketMessageFilter::OnRecvFromCompleted,
|
| base::Unretained(this)));
|
| if (net_result != net::ERR_IO_PENDING)
|
|
|