Chromium Code Reviews| 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 6a87b54e09ae9016ea3ccd9b359ac66ef15d7c8e..d268a4d8451612cc366620beacfcf9c68649a09c 100644 |
| --- a/net/spdy/spdy_proxy_client_socket.cc |
| +++ b/net/spdy/spdy_proxy_client_socket.cc |
| @@ -36,18 +36,18 @@ SpdyProxyClientSocket::SpdyProxyClientSocket( |
| : next_state_(STATE_DISCONNECTED), |
| spdy_stream_(spdy_stream), |
| endpoint_(endpoint), |
| - auth_( |
| - new HttpAuthController(HttpAuth::AUTH_PROXY, |
| - GURL("https://" + proxy_server.ToString()), |
| - auth_cache, |
| - auth_handler_factory)), |
| + auth_(new HttpAuthController(HttpAuth::AUTH_PROXY, |
| + GURL("https://" + proxy_server.ToString()), |
| + auth_cache, |
| + auth_handler_factory)), |
|
wtc
2014/06/13 18:03:50
This change was made by "git cl format". Let me kn
|
| user_buffer_len_(0), |
| write_buffer_len_(0), |
| was_ever_used_(false), |
| redirect_has_load_timing_info_(false), |
| net_log_(BoundNetLog::Make(spdy_stream->net_log().net_log(), |
| NetLog::SOURCE_PROXY_CLIENT_SOCKET)), |
| - weak_factory_(this) { |
| + weak_factory_(this), |
| + write_callback_weak_factory_(this) { |
| request_.method = "CONNECT"; |
| request_.url = url; |
| if (!user_agent.empty()) |
| @@ -137,6 +137,7 @@ void SpdyProxyClientSocket::Disconnect() { |
| write_buffer_len_ = 0; |
| write_callback_.Reset(); |
| + write_callback_weak_factory_.InvalidateWeakPtrs(); |
| next_state_ = STATE_DISCONNECTED; |
| @@ -268,6 +269,11 @@ void SpdyProxyClientSocket::LogBlockedTunnelResponse() const { |
| /* is_https_proxy = */ true); |
| } |
| +void SpdyProxyClientSocket::RunCallback(const CompletionCallback& callback, |
| + int result) const { |
| + callback.Run(result); |
| +} |
| + |
| void SpdyProxyClientSocket::OnIOComplete(int result) { |
| DCHECK_NE(STATE_DISCONNECTED, next_state_); |
| int rv = DoLoop(result); |
| @@ -488,7 +494,10 @@ void SpdyProxyClientSocket::OnDataSent() { |
| // stream's write callback chain to unwind (see crbug.com/355511). |
| base::MessageLoop::current()->PostTask( |
| FROM_HERE, |
| - base::Bind(ResetAndReturn(&write_callback_), rv)); |
| + base::Bind(&SpdyProxyClientSocket::RunCallback, |
| + write_callback_weak_factory_.GetWeakPtr(), |
| + ResetAndReturn(&write_callback_), |
| + rv)); |
| } |
| void SpdyProxyClientSocket::OnClose(int status) { |