diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-21 22:44:04 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-21 22:44:04 +0000 |
commit | 4d4a5164794bd100ef49451cf1c48d0d57823f41 (patch) | |
tree | 9fbd5adf983a0ee908afc989a51bc7554cc9e5fc /net/http/http_stream_request.cc | |
parent | 4f5732a4da9058df1dd5c65f48d79414ce47fb76 (diff) | |
download | chromium_src-4d4a5164794bd100ef49451cf1c48d0d57823f41.zip chromium_src-4d4a5164794bd100ef49451cf1c48d0d57823f41.tar.gz chromium_src-4d4a5164794bd100ef49451cf1c48d0d57823f41.tar.bz2 |
Eliminate HttpStreamHandle. The name confused me.
HttpStreamHandle was a combination of an HttpStream and a
scoped_ptr<ClientSocketHandle>. This let it manage the transport socket if
so desired. I think that the HttpStream should be in charge of managing this.
* HttpBasicStream should always release it to the pool when done, but perhaps
disconnect it first.
* HttpPipelinedStream (or whatever we name it) should know not to disconnect
the transport socket or whatever. It should return it to the pipeline stream
manager.
* SPDY subtypes of HttpStream do not manage the transport socket. They let the
SpdySession handle it.
Since the ownership pattern varies based on the HttpStream subtype, I think
letting a HttpStreamHandle class perhaps control it is confusing. It's better
for the subtype to know what it's supposed to do.
There was only one hangup here, the HttpProxyClientSocket, since it might need
to Disconnect() and then re-Connect() the transport socket. It was using an
HttpBasicStream, which, with my change, would own the transport socket handle.
I fixed this by making the HttpProxyClientSocket create an HttpStreamParser
instead, which does not own the transport socket handle.
Review URL: http://codereview.chromium.org/3133029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60117 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_stream_request.cc')
-rw-r--r-- | net/http/http_stream_request.cc | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/net/http/http_stream_request.cc b/net/http/http_stream_request.cc index cbc2188..0486ac2 100644 --- a/net/http/http_stream_request.cc +++ b/net/http/http_stream_request.cc @@ -15,7 +15,6 @@ #include "net/http/http_network_session.h" #include "net/http/http_proxy_client_socket.h" #include "net/http/http_request_info.h" -#include "net/http/http_stream_handle.h" #include "net/spdy/spdy_http_stream.h" #include "net/spdy/spdy_session.h" #include "net/spdy/spdy_session_pool.h" @@ -178,7 +177,7 @@ SSLConfig* HttpStreamRequest::ssl_config() const { return ssl_config_; } -void HttpStreamRequest::OnStreamReadyCallback(HttpStreamHandle* stream) { +void HttpStreamRequest::OnStreamReadyCallback(HttpStream* stream) { if (cancelled_) { // The delegate is gone. We need to cleanup the stream. delete stream; @@ -232,7 +231,8 @@ int HttpStreamRequest::RunLoop(int result) { GetSSLInfo(); next_state_ = STATE_WAITING_USER_ACTION; - MessageLoop::current()->PostTask(FROM_HERE, + MessageLoop::current()->PostTask( + FROM_HERE, NewRunnableMethod(this, &HttpStreamRequest::OnCertificateErrorCallback, result, ssl_info_)); @@ -252,7 +252,8 @@ int HttpStreamRequest::RunLoop(int result) { http_proxy_socket->GetResponseInfo(); next_state_ = STATE_WAITING_USER_ACTION; - MessageLoop::current()->PostTask(FROM_HERE, + MessageLoop::current()->PostTask( + FROM_HERE, NewRunnableMethod(this, &HttpStreamRequest::OnNeedsProxyAuthCallback, *tunnel_auth_response, @@ -261,7 +262,8 @@ int HttpStreamRequest::RunLoop(int result) { return ERR_IO_PENDING; case ERR_SSL_CLIENT_AUTH_CERT_NEEDED: - MessageLoop::current()->PostTask(FROM_HERE, + MessageLoop::current()->PostTask( + FROM_HERE, NewRunnableMethod(this, &HttpStreamRequest::OnNeedsClientAuthCallback, connection_->ssl_error_response_info().cert_request_info)); @@ -271,14 +273,16 @@ int HttpStreamRequest::RunLoop(int result) { break; case OK: - MessageLoop::current()->PostTask(FROM_HERE, + MessageLoop::current()->PostTask( + FROM_HERE, NewRunnableMethod(this, &HttpStreamRequest::OnStreamReadyCallback, stream_.release())); return ERR_IO_PENDING; default: - MessageLoop::current()->PostTask(FROM_HERE, + MessageLoop::current()->PostTask( + FROM_HERE, NewRunnableMethod(this, &HttpStreamRequest::OnStreamFailedCallback, result)); @@ -676,8 +680,7 @@ int HttpStreamRequest::DoCreateStream() { SetSocketMotivation(); if (!using_spdy_) { - HttpBasicStream* stream = new HttpBasicStream(connection_.get()); - stream_.reset(new HttpStreamHandle(connection_.release(), stream)); + stream_.reset(new HttpBasicStream(connection_.release())); return OK; } @@ -720,8 +723,7 @@ int HttpStreamRequest::DoCreateStream() { if (spdy_session->IsClosed()) return ERR_CONNECTION_CLOSED; - SpdyHttpStream* stream = new SpdyHttpStream(spdy_session, direct); - stream_.reset(new HttpStreamHandle(NULL, stream)); + stream_.reset(new SpdyHttpStream(spdy_session, direct)); return OK; } |