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

Unified Diff: net/http/http_proxy_client_socket.cc

Issue 8990001: base::Bind: Convert most of net/http. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clang. 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
Index: net/http/http_proxy_client_socket.cc
diff --git a/net/http/http_proxy_client_socket.cc b/net/http/http_proxy_client_socket.cc
index 4b03ba8c42c46fa745139d3828cee92ff10effb5..b47367c3a02eee84078d7c3a4a7bd9363e03566a 100644
--- a/net/http/http_proxy_client_socket.cc
+++ b/net/http/http_proxy_client_socket.cc
@@ -4,6 +4,8 @@
#include "net/http/http_proxy_client_socket.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "googleurl/src/gurl.h"
@@ -34,8 +36,9 @@ HttpProxyClientSocket::HttpProxyClientSocket(
bool tunnel,
bool using_spdy,
bool is_https_proxy)
- : ALLOW_THIS_IN_INITIALIZER_LIST(
- io_callback_(this, &HttpProxyClientSocket::OnIOComplete)),
+ : ALLOW_THIS_IN_INITIALIZER_LIST(io_callback_(
+ base::Bind(&HttpProxyClientSocket::OnIOComplete,
+ base::Unretained(this)))),
next_state_(STATE_NONE),
transport_(transport_socket),
endpoint_(endpoint),
@@ -62,7 +65,7 @@ HttpProxyClientSocket::~HttpProxyClientSocket() {
Disconnect();
}
-int HttpProxyClientSocket::RestartWithAuth(OldCompletionCallback* callback) {
+int HttpProxyClientSocket::RestartWithAuth(const CompletionCallback& callback) {
DCHECK_EQ(STATE_NONE, next_state_);
DCHECK(user_callback_.is_null());
@@ -71,11 +74,11 @@ int HttpProxyClientSocket::RestartWithAuth(OldCompletionCallback* callback) {
return rv;
rv = DoLoop(OK);
- if (rv == ERR_IO_PENDING)
- if (callback) {
- user_callback_ = base::Bind(&OldCompletionCallback::Run<int>,
- base::Unretained(callback));
- }
+ if (rv == ERR_IO_PENDING) {
+ if (!callback.is_null())
+ user_callback_ = callback;
+ }
+
return rv;
}
@@ -370,7 +373,7 @@ int HttpProxyClientSocket::DoLoop(int last_io_result) {
int HttpProxyClientSocket::DoGenerateAuthToken() {
next_state_ = STATE_GENERATE_AUTH_TOKEN_COMPLETE;
- return auth_->MaybeGenerateAuthToken(&request_, &io_callback_, net_log_);
+ return auth_->MaybeGenerateAuthToken(&request_, io_callback_, net_log_);
}
int HttpProxyClientSocket::DoGenerateAuthTokenComplete(int result) {
@@ -404,7 +407,7 @@ int HttpProxyClientSocket::DoSendRequest() {
http_stream_parser_.reset(
new HttpStreamParser(transport_.get(), &request_, parser_buf_, net_log_));
return http_stream_parser_->SendRequest(request_line_, request_headers_, NULL,
- &response_, &io_callback_);
+ &response_, io_callback_);
}
int HttpProxyClientSocket::DoSendRequestComplete(int result) {
@@ -417,7 +420,7 @@ int HttpProxyClientSocket::DoSendRequestComplete(int result) {
int HttpProxyClientSocket::DoReadHeaders() {
next_state_ = STATE_READ_HEADERS_COMPLETE;
- return http_stream_parser_->ReadResponseHeaders(&io_callback_);
+ return http_stream_parser_->ReadResponseHeaders(io_callback_);
}
int HttpProxyClientSocket::DoReadHeadersComplete(int result) {
@@ -475,7 +478,7 @@ int HttpProxyClientSocket::DoDrainBody() {
DCHECK(transport_->is_initialized());
next_state_ = STATE_DRAIN_BODY_COMPLETE;
return http_stream_parser_->ReadResponseBody(drain_buf_, kDrainBodyBufferSize,
- &io_callback_);
+ io_callback_);
}
int HttpProxyClientSocket::DoDrainBodyComplete(int result) {

Powered by Google App Engine
This is Rietveld 408576698