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

Unified Diff: net/spdy/spdy_proxy_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_proxy_client_socket.h ('k') | net/udp/udp_client_socket.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_proxy_client_socket.cc
diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc
index c9f0d8f1959439f7a9ab965b0381c9a94a4f8ff1..7b2c83bbc83d558cd9360f10490dd89ead5005f7 100644
--- a/net/spdy/spdy_proxy_client_socket.cc
+++ b/net/spdy/spdy_proxy_client_socket.cc
@@ -196,6 +196,30 @@ int SpdyProxyClientSocket::Read(IOBuffer* buf, int buf_len,
user_buffer_ = NULL;
return result;
}
+int SpdyProxyClientSocket::Read(IOBuffer* buf, int buf_len,
+ const CompletionCallback& callback) {
+ DCHECK(!old_read_callback_ && read_callback_.is_null());
+ DCHECK(!user_buffer_);
+
+ if (next_state_ == STATE_DISCONNECTED)
+ return ERR_SOCKET_NOT_CONNECTED;
+
+ if (next_state_ == STATE_CLOSED && read_buffer_.empty()) {
+ return 0;
+ }
+
+ DCHECK(next_state_ == STATE_OPEN || next_state_ == STATE_CLOSED);
+ DCHECK(buf);
+ user_buffer_ = new DrainableIOBuffer(buf, buf_len);
+ int result = PopulateUserReadBuffer();
+ if (result == 0) {
+ DCHECK(!callback.is_null());
+ read_callback_ = callback;
+ return ERR_IO_PENDING;
+ }
+ user_buffer_ = NULL;
+ return result;
+}
int SpdyProxyClientSocket::PopulateUserReadBuffer() {
if (!user_buffer_)
« no previous file with comments | « net/spdy/spdy_proxy_client_socket.h ('k') | net/udp/udp_client_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698