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

Side by Side Diff: net/socket/socks_client_socket.cc

Issue 8801005: base::Bind: Convert Socket::Read. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 9 years 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
« no previous file with comments | « net/socket/socks_client_socket.h ('k') | net/socket/ssl_client_socket_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "net/socket/socks_client_socket.h" 5 #include "net/socket/socks_client_socket.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 return base::TimeDelta::FromMicroseconds(-1); 209 return base::TimeDelta::FromMicroseconds(-1);
210 } 210 }
211 211
212 212
213 // Read is called by the transport layer above to read. This can only be done 213 // Read is called by the transport layer above to read. This can only be done
214 // if the SOCKS handshake is complete. 214 // if the SOCKS handshake is complete.
215 int SOCKSClientSocket::Read(IOBuffer* buf, int buf_len, 215 int SOCKSClientSocket::Read(IOBuffer* buf, int buf_len,
216 OldCompletionCallback* callback) { 216 OldCompletionCallback* callback) {
217 DCHECK(completed_handshake_); 217 DCHECK(completed_handshake_);
218 DCHECK_EQ(STATE_NONE, next_state_); 218 DCHECK_EQ(STATE_NONE, next_state_);
219 DCHECK(!old_user_callback_); 219 DCHECK(!old_user_callback_ && user_callback_.is_null());
220 220
221 return transport_->socket()->Read(buf, buf_len, callback); 221 return transport_->socket()->Read(buf, buf_len, callback);
222 } 222 }
223 int SOCKSClientSocket::Read(IOBuffer* buf, int buf_len,
224 const CompletionCallback& callback) {
225 DCHECK(completed_handshake_);
226 DCHECK_EQ(STATE_NONE, next_state_);
227 DCHECK(!old_user_callback_ && user_callback_.is_null());
228
229 return transport_->socket()->Read(buf, buf_len, callback);
230 }
223 231
224 // Write is called by the transport layer. This can only be done if the 232 // Write is called by the transport layer. This can only be done if the
225 // SOCKS handshake is complete. 233 // SOCKS handshake is complete.
226 int SOCKSClientSocket::Write(IOBuffer* buf, int buf_len, 234 int SOCKSClientSocket::Write(IOBuffer* buf, int buf_len,
227 OldCompletionCallback* callback) { 235 OldCompletionCallback* callback) {
228 DCHECK(completed_handshake_); 236 DCHECK(completed_handshake_);
229 DCHECK_EQ(STATE_NONE, next_state_); 237 DCHECK_EQ(STATE_NONE, next_state_);
230 DCHECK(!old_user_callback_); 238 DCHECK(!old_user_callback_);
231 239
232 return transport_->socket()->Write(buf, buf_len, callback); 240 return transport_->socket()->Write(buf, buf_len, callback);
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 469
462 int SOCKSClientSocket::GetPeerAddress(AddressList* address) const { 470 int SOCKSClientSocket::GetPeerAddress(AddressList* address) const {
463 return transport_->socket()->GetPeerAddress(address); 471 return transport_->socket()->GetPeerAddress(address);
464 } 472 }
465 473
466 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const { 474 int SOCKSClientSocket::GetLocalAddress(IPEndPoint* address) const {
467 return transport_->socket()->GetLocalAddress(address); 475 return transport_->socket()->GetLocalAddress(address);
468 } 476 }
469 477
470 } // namespace net 478 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socks_client_socket.h ('k') | net/socket/ssl_client_socket_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698