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

Side by Side Diff: content/browser/renderer_host/pepper/pepper_tcp_socket.cc

Issue 217573002: make SetReceiveBufferSize and SetSendBufferSize return net error codes (instead of bools) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: process error code in quic_stream_factory 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 SendSetOptionACK(PP_ERROR_BADARGUMENT); 253 SendSetOptionACK(PP_ERROR_BADARGUMENT);
254 return; 254 return;
255 } 255 }
256 256
257 bool result = false; 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 result = tcp_socket->SetSendBufferSize(integer_value); 263 result = tcp_socket->SetSendBufferSize(integer_value) == net::OK;
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 result = tcp_socket->SetReceiveBufferSize(integer_value); 269 result = tcp_socket->SetReceiveBufferSize(integer_value) == net::OK;
270 } 270 }
271 SendSetOptionACK(result ? PP_OK : PP_ERROR_FAILED); 271 SendSetOptionACK(result ? PP_OK : PP_ERROR_FAILED);
wtc 2014/03/29 13:30:12 Nit: You can ignore this suggestion. int result
jar (doing other things) 2014/04/01 23:50:39 I made the change, and added a TODO... but assigne
272 return; 272 return;
273 } 273 }
274 default: { 274 default: {
275 NOTREACHED(); 275 NOTREACHED();
276 SendSetOptionACK(PP_ERROR_BADARGUMENT); 276 SendSetOptionACK(PP_ERROR_BADARGUMENT);
277 return; 277 return;
278 } 278 }
279 } 279 }
280 } 280 }
281 281
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 518
519 int net_result = socket_->Write( 519 int net_result = socket_->Write(
520 write_buffer_.get(), 520 write_buffer_.get(),
521 write_buffer_->BytesRemaining(), 521 write_buffer_->BytesRemaining(),
522 base::Bind(&PepperTCPSocket::OnWriteCompleted, base::Unretained(this))); 522 base::Bind(&PepperTCPSocket::OnWriteCompleted, base::Unretained(this)));
523 if (net_result != net::ERR_IO_PENDING) 523 if (net_result != net::ERR_IO_PENDING)
524 OnWriteCompleted(net_result); 524 OnWriteCompleted(net_result);
525 } 525 }
526 526
527 } // namespace content 527 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698