Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: trunk/src/content/browser/renderer_host/pepper/pepper_tcp_socket_message_filter.cc

Issue 227083002: Revert 261966 "make SetReceiveBufferSize and SetSendBufferSize r..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/pepper/pepper_tcp_socket_message_filter. h" 5 #include "content/browser/renderer_host/pepper/pepper_tcp_socket_message_filter. h"
6 6
7 #include <cstring> 7 #include <cstring>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 } 448 }
449 case PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE: 449 case PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE:
450 case PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE: { 450 case PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE: {
451 if (state_.state() != TCPSocketState::CONNECTED) 451 if (state_.state() != TCPSocketState::CONNECTED)
452 return PP_ERROR_FAILED; 452 return PP_ERROR_FAILED;
453 453
454 int32_t integer_value = 0; 454 int32_t integer_value = 0;
455 if (!value.GetInt32(&integer_value) || integer_value <= 0) 455 if (!value.GetInt32(&integer_value) || integer_value <= 0)
456 return PP_ERROR_BADARGUMENT; 456 return PP_ERROR_BADARGUMENT;
457 457
458 int net_result = net::OK; 458 bool result = false;
459 if (name == PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE) { 459 if (name == PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE) {
460 if (integer_value > TCPSocketResourceBase::kMaxSendBufferSize) 460 if (integer_value > TCPSocketResourceBase::kMaxSendBufferSize)
461 return PP_ERROR_BADARGUMENT; 461 return PP_ERROR_BADARGUMENT;
462 net_result = socket_->SetSendBufferSize(integer_value); 462 result = socket_->SetSendBufferSize(integer_value);
463 } else { 463 } else {
464 if (integer_value > TCPSocketResourceBase::kMaxReceiveBufferSize) 464 if (integer_value > TCPSocketResourceBase::kMaxReceiveBufferSize)
465 return PP_ERROR_BADARGUMENT; 465 return PP_ERROR_BADARGUMENT;
466 net_result = socket_->SetReceiveBufferSize(integer_value); 466 result = socket_->SetReceiveBufferSize(integer_value);
467 } 467 }
468 // TODO(wtc): Add error mapping code. 468 return result ? PP_OK : PP_ERROR_FAILED;
469 return (net_result == net::OK) ? PP_OK : PP_ERROR_FAILED;
470 } 469 }
471 default: { 470 default: {
472 NOTREACHED(); 471 NOTREACHED();
473 return PP_ERROR_BADARGUMENT; 472 return PP_ERROR_BADARGUMENT;
474 } 473 }
475 } 474 }
476 } 475 }
477 476
478 void PepperTCPSocketMessageFilter::DoBind( 477 void PepperTCPSocketMessageFilter::DoBind(
479 const ppapi::host::ReplyMessageContext& context, 478 const ppapi::host::ReplyMessageContext& context,
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 970
972 void PepperTCPSocketMessageFilter::SendAcceptError( 971 void PepperTCPSocketMessageFilter::SendAcceptError(
973 const ppapi::host::ReplyMessageContext& context, 972 const ppapi::host::ReplyMessageContext& context,
974 int32_t pp_error) { 973 int32_t pp_error) {
975 SendAcceptReply(context, pp_error, 0, 974 SendAcceptReply(context, pp_error, 0,
976 NetAddressPrivateImpl::kInvalidNetAddress, 975 NetAddressPrivateImpl::kInvalidNetAddress,
977 NetAddressPrivateImpl::kInvalidNetAddress); 976 NetAddressPrivateImpl::kInvalidNetAddress);
978 } 977 }
979 978
980 } // namespace content 979 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698