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

Side by Side Diff: trunk/src/content/browser/renderer_host/pepper/pepper_tcp_socket.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "content/browser/renderer_host/pepper/pepper_tcp_socket.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 return; 247 return;
248 } 248 }
249 case PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE: 249 case PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE:
250 case PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE: { 250 case PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE: {
251 int32_t integer_value = 0; 251 int32_t integer_value = 0;
252 if (!value.GetInt32(&integer_value) || integer_value <= 0) { 252 if (!value.GetInt32(&integer_value) || integer_value <= 0) {
253 SendSetOptionACK(PP_ERROR_BADARGUMENT); 253 SendSetOptionACK(PP_ERROR_BADARGUMENT);
254 return; 254 return;
255 } 255 }
256 256
257 int net_result = net::OK; 257 bool result = false;
258 if (name == PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE) { 258 if (name == PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE) {
259 if (integer_value > ppapi::TCPSocketShared::kMaxSendBufferSize) { 259 if (integer_value > ppapi::TCPSocketShared::kMaxSendBufferSize) {
260 SendSetOptionACK(PP_ERROR_BADARGUMENT); 260 SendSetOptionACK(PP_ERROR_BADARGUMENT);
261 return; 261 return;
262 } 262 }
263 net_result = tcp_socket->SetSendBufferSize(integer_value); 263 result = tcp_socket->SetSendBufferSize(integer_value);
264 } else { 264 } else {
265 if (integer_value > ppapi::TCPSocketShared::kMaxReceiveBufferSize) { 265 if (integer_value > ppapi::TCPSocketShared::kMaxReceiveBufferSize) {
266 SendSetOptionACK(PP_ERROR_BADARGUMENT); 266 SendSetOptionACK(PP_ERROR_BADARGUMENT);
267 return; 267 return;
268 } 268 }
269 net_result = tcp_socket->SetReceiveBufferSize(integer_value); 269 result = tcp_socket->SetReceiveBufferSize(integer_value);
270 } 270 }
271 // TODO(wtc): Add error mapping. 271 SendSetOptionACK(result ? PP_OK : PP_ERROR_FAILED);
272 SendSetOptionACK((net_result == net::OK) ? PP_OK : PP_ERROR_FAILED);
273 return; 272 return;
274 } 273 }
275 default: { 274 default: {
276 NOTREACHED(); 275 NOTREACHED();
277 SendSetOptionACK(PP_ERROR_BADARGUMENT); 276 SendSetOptionACK(PP_ERROR_BADARGUMENT);
278 return; 277 return;
279 } 278 }
280 } 279 }
281 } 280 }
282 281
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 518
520 int net_result = socket_->Write( 519 int net_result = socket_->Write(
521 write_buffer_.get(), 520 write_buffer_.get(),
522 write_buffer_->BytesRemaining(), 521 write_buffer_->BytesRemaining(),
523 base::Bind(&PepperTCPSocket::OnWriteCompleted, base::Unretained(this))); 522 base::Bind(&PepperTCPSocket::OnWriteCompleted, base::Unretained(this)));
524 if (net_result != net::ERR_IO_PENDING) 523 if (net_result != net::ERR_IO_PENDING)
525 OnWriteCompleted(net_result); 524 OnWriteCompleted(net_result);
526 } 525 }
527 526
528 } // namespace content 527 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698