| Index: net/http/http_stream_factory_impl_request.cc
|
| diff --git a/net/http/http_stream_factory_impl_request.cc b/net/http/http_stream_factory_impl_request.cc
|
| index 23aa5ff2b3beb2104acb6a657fad800607091e73..c080e695870f4821d36f137e1973f2ea4266bc20 100644
|
| --- a/net/http/http_stream_factory_impl_request.cc
|
| +++ b/net/http/http_stream_factory_impl_request.cc
|
| @@ -13,12 +13,15 @@
|
|
|
| namespace net {
|
|
|
| -HttpStreamFactoryImpl::Request::Request(const GURL& url,
|
| - HttpStreamFactoryImpl* factory,
|
| - HttpStreamRequest::Delegate* delegate,
|
| - const BoundNetLog& net_log)
|
| +HttpStreamFactoryImpl::Request::Request(
|
| + const GURL& url,
|
| + HttpStreamFactoryImpl* factory,
|
| + HttpStreamRequest::Delegate* delegate,
|
| + WebSocketStreamBase::Factory* websocket_stream_factory,
|
| + const BoundNetLog& net_log)
|
| : url_(url),
|
| factory_(factory),
|
| + websocket_stream_factory_(websocket_stream_factory),
|
| delegate_(delegate),
|
| net_log_(net_log),
|
| completed_(false),
|
| @@ -94,14 +97,7 @@ void HttpStreamFactoryImpl::Request::Complete(
|
| net_log_.source().ToEventParametersCallback());
|
| }
|
|
|
| -void HttpStreamFactoryImpl::Request::OnStreamReady(
|
| - Job* job,
|
| - const SSLConfig& used_ssl_config,
|
| - const ProxyInfo& used_proxy_info,
|
| - HttpStreamBase* stream) {
|
| - DCHECK(stream);
|
| - DCHECK(completed_);
|
| -
|
| +void HttpStreamFactoryImpl::Request::Orphan(Job* job) {
|
| // |job| should only be NULL if we're being serviced by a late bound
|
| // SpdySession or HttpPipelinedConnection (one that was not created by a job
|
| // in our |jobs_| set).
|
| @@ -123,9 +119,34 @@ void HttpStreamFactoryImpl::Request::OnStreamReady(
|
| } else {
|
| DCHECK(jobs_.empty());
|
| }
|
| +}
|
| +
|
| +void HttpStreamFactoryImpl::Request::OnStreamReady(
|
| + Job* job,
|
| + const SSLConfig& used_ssl_config,
|
| + const ProxyInfo& used_proxy_info,
|
| + HttpStreamBase* stream) {
|
| + DCHECK(!factory_->for_websockets_);
|
| + DCHECK(stream);
|
| + DCHECK(completed_);
|
| +
|
| + Orphan(job);
|
| delegate_->OnStreamReady(used_ssl_config, used_proxy_info, stream);
|
| }
|
|
|
| +void HttpStreamFactoryImpl::Request::OnWebSocketStreamReady(
|
| + Job* job,
|
| + const SSLConfig& used_ssl_config,
|
| + const ProxyInfo& used_proxy_info,
|
| + WebSocketStreamBase* stream) {
|
| + DCHECK(factory_->for_websockets_);
|
| + DCHECK(stream);
|
| + DCHECK(completed_);
|
| +
|
| + Orphan(job);
|
| + delegate_->OnWebSocketStreamReady(used_ssl_config, used_proxy_info, stream);
|
| +}
|
| +
|
| void HttpStreamFactoryImpl::Request::OnStreamFailed(
|
| Job* job,
|
| int status,
|
| @@ -280,7 +301,7 @@ HttpStreamFactoryImpl::Request::RemoveRequestFromHttpPipeliningRequestMap() {
|
| }
|
| }
|
|
|
| -void HttpStreamFactoryImpl::Request::OnSpdySessionReady(
|
| +void HttpStreamFactoryImpl::Request::OnNewSpdySessionReady(
|
| Job* job,
|
| scoped_refptr<SpdySession> spdy_session,
|
| bool direct) {
|
| @@ -290,7 +311,7 @@ void HttpStreamFactoryImpl::Request::OnSpdySessionReady(
|
| // The first case is the usual case.
|
| if (!bound_job_.get()) {
|
| OrphanJobsExcept(job);
|
| - } else { // This is the case for HTTPS proxy tunneling.
|
| + } else { // This is the case for HTTPS proxy tunneling.
|
| DCHECK_EQ(bound_job_.get(), job);
|
| DCHECK(jobs_.empty());
|
| }
|
| @@ -308,14 +329,25 @@ void HttpStreamFactoryImpl::Request::OnSpdySessionReady(
|
|
|
| // Cache this so we can still use it if the request is deleted.
|
| HttpStreamFactoryImpl* factory = factory_;
|
| -
|
| - bool use_relative_url = direct || url().SchemeIs("https");
|
| - delegate_->OnStreamReady(
|
| - job->server_ssl_config(),
|
| - job->proxy_info(),
|
| - new SpdyHttpStream(spdy_session, use_relative_url));
|
| + WebSocketStreamBase::Factory* websocket_stream_factory =
|
| + websocket_stream_factory_;
|
| + if (factory->for_websockets_) {
|
| + DCHECK(websocket_stream_factory);
|
| + bool use_relative_url = direct || url().SchemeIs("wss");
|
| + delegate_->OnWebSocketStreamReady(
|
| + job->server_ssl_config(),
|
| + job->proxy_info(),
|
| + websocket_stream_factory->CreateSpdyStream(
|
| + spdy_session, use_relative_url));
|
| + } else {
|
| + bool use_relative_url = direct || url().SchemeIs("https");
|
| + delegate_->OnStreamReady(
|
| + job->server_ssl_config(),
|
| + job->proxy_info(),
|
| + new SpdyHttpStream(spdy_session, use_relative_url));
|
| + }
|
| // |this| may be deleted after this point.
|
| - factory->OnSpdySessionReady(
|
| + factory->OnNewSpdySessionReady(
|
| spdy_session, direct, used_ssl_config, used_proxy_info,
|
| was_npn_negotiated, protocol_negotiated, using_spdy, net_log);
|
| }
|
|
|