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

Side by Side Diff: net/socket/socks5_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/socks5_client_socket.h ('k') | net/socket/socks_client_socket.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/socks5_client_socket.h" 5 #include "net/socket/socks5_client_socket.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 NOTREACHED(); 181 NOTREACHED();
182 return base::TimeDelta::FromMicroseconds(-1); 182 return base::TimeDelta::FromMicroseconds(-1);
183 } 183 }
184 184
185 // Read is called by the transport layer above to read. This can only be done 185 // Read is called by the transport layer above to read. This can only be done
186 // if the SOCKS handshake is complete. 186 // if the SOCKS handshake is complete.
187 int SOCKS5ClientSocket::Read(IOBuffer* buf, int buf_len, 187 int SOCKS5ClientSocket::Read(IOBuffer* buf, int buf_len,
188 OldCompletionCallback* callback) { 188 OldCompletionCallback* callback) {
189 DCHECK(completed_handshake_); 189 DCHECK(completed_handshake_);
190 DCHECK_EQ(STATE_NONE, next_state_); 190 DCHECK_EQ(STATE_NONE, next_state_);
191 DCHECK(!old_user_callback_); 191 DCHECK(!old_user_callback_ && user_callback_.is_null());
192 192
193 return transport_->socket()->Read(buf, buf_len, callback); 193 return transport_->socket()->Read(buf, buf_len, callback);
194 } 194 }
195 int SOCKS5ClientSocket::Read(IOBuffer* buf, int buf_len,
196 const CompletionCallback& callback) {
197 DCHECK(completed_handshake_);
198 DCHECK_EQ(STATE_NONE, next_state_);
199 DCHECK(!old_user_callback_ && user_callback_.is_null());
200
201 return transport_->socket()->Read(buf, buf_len, callback);
202 }
195 203
196 // Write is called by the transport layer. This can only be done if the 204 // Write is called by the transport layer. This can only be done if the
197 // SOCKS handshake is complete. 205 // SOCKS handshake is complete.
198 int SOCKS5ClientSocket::Write(IOBuffer* buf, int buf_len, 206 int SOCKS5ClientSocket::Write(IOBuffer* buf, int buf_len,
199 OldCompletionCallback* callback) { 207 OldCompletionCallback* callback) {
200 DCHECK(completed_handshake_); 208 DCHECK(completed_handshake_);
201 DCHECK_EQ(STATE_NONE, next_state_); 209 DCHECK_EQ(STATE_NONE, next_state_);
202 DCHECK(!old_user_callback_); 210 DCHECK(!old_user_callback_);
203 211
204 return transport_->socket()->Write(buf, buf_len, callback); 212 return transport_->socket()->Write(buf, buf_len, callback);
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 535
528 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const { 536 int SOCKS5ClientSocket::GetPeerAddress(AddressList* address) const {
529 return transport_->socket()->GetPeerAddress(address); 537 return transport_->socket()->GetPeerAddress(address);
530 } 538 }
531 539
532 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const { 540 int SOCKS5ClientSocket::GetLocalAddress(IPEndPoint* address) const {
533 return transport_->socket()->GetLocalAddress(address); 541 return transport_->socket()->GetLocalAddress(address);
534 } 542 }
535 543
536 } // namespace net 544 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socks5_client_socket.h ('k') | net/socket/socks_client_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698