Chromium Code Reviews| 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 9e2f9dc3d94c49a617ee2cd23066175424a470a1..bd4765fd48f580377532438f370f24d97b958461 100644 |
| --- a/net/http/http_stream_factory_impl_request.cc |
| +++ b/net/http/http_stream_factory_impl_request.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/callback.h" |
| #include "base/logging.h" |
| #include "base/stl_util.h" |
| +#include "net/http/bidirectional_stream.h" |
| #include "net/http/http_stream_factory_impl_job.h" |
| #include "net/spdy/spdy_http_stream.h" |
| #include "net/spdy/spdy_session.h" |
| @@ -19,7 +20,8 @@ HttpStreamFactoryImpl::Request::Request( |
| HttpStreamRequest::Delegate* delegate, |
| WebSocketHandshakeStreamBase::CreateHelper* |
| websocket_handshake_stream_create_helper, |
| - const BoundNetLog& net_log) |
| + const BoundNetLog& net_log, |
| + bool for_bidirectional) |
| : url_(url), |
| factory_(factory), |
| websocket_handshake_stream_create_helper_( |
| @@ -29,7 +31,8 @@ HttpStreamFactoryImpl::Request::Request( |
| completed_(false), |
| was_npn_negotiated_(false), |
| protocol_negotiated_(kProtoUnknown), |
| - using_spdy_(false) { |
| + using_spdy_(false), |
| + for_bidirectional_(for_bidirectional) { |
| DCHECK(factory_); |
| DCHECK(delegate_); |
| @@ -77,6 +80,7 @@ void HttpStreamFactoryImpl::Request::OnStreamReady( |
| const ProxyInfo& used_proxy_info, |
| HttpStream* stream) { |
| DCHECK(!factory_->for_websockets_); |
| + DCHECK(!for_bidirectional_); |
| DCHECK(stream); |
| DCHECK(completed_); |
| @@ -84,12 +88,28 @@ void HttpStreamFactoryImpl::Request::OnStreamReady( |
| delegate_->OnStreamReady(used_ssl_config, used_proxy_info, stream); |
| } |
| +void HttpStreamFactoryImpl::Request::OnBidirectionalStreamReady( |
| + Job* job, |
| + const SSLConfig& used_ssl_config, |
| + const ProxyInfo& used_proxy_info, |
| + BidirectionalStream* stream) { |
| + DCHECK(!factory_->for_websockets_); |
| + DCHECK(for_bidirectional_); |
| + DCHECK(stream); |
| + DCHECK(completed_); |
| + |
| + OnJobSucceeded(job); |
| + delegate_->OnBidirectionalStreamReady(used_ssl_config, used_proxy_info, |
| + stream); |
| +} |
| + |
| void HttpStreamFactoryImpl::Request::OnWebSocketHandshakeStreamReady( |
| Job* job, |
| const SSLConfig& used_ssl_config, |
| const ProxyInfo& used_proxy_info, |
| WebSocketHandshakeStreamBase* stream) { |
| DCHECK(factory_->for_websockets_); |
| + DCHECK(!for_bidirectional_); |
| DCHECK(stream); |
| DCHECK(completed_); |
| @@ -252,6 +272,7 @@ bool HttpStreamFactoryImpl::Request::HasSpdySessionKey() const { |
| void HttpStreamFactoryImpl::Request::OnNewSpdySessionReady( |
| Job* job, |
| scoped_ptr<HttpStream> stream, |
| + scoped_ptr<BidirectionalStream> bidirectional_stream, |
| const base::WeakPtr<SpdySession>& spdy_session, |
| bool direct) { |
| DCHECK(job); |
| @@ -286,6 +307,10 @@ void HttpStreamFactoryImpl::Request::OnNewSpdySessionReady( |
| // TODO(ricea): Re-instate this code when WebSockets over SPDY is |
| // implemented. |
| NOTREACHED(); |
| + } else if (for_bidirectional_) { |
|
mmenke
2015/10/08 19:31:53
Maybe add DCHECK(bidirectional_stream); DCHECK(!st
xunjieli
2015/10/19 21:07:46
Done.
|
| + delegate_->OnBidirectionalStreamReady(job->server_ssl_config(), |
| + job->proxy_info(), |
| + bidirectional_stream.release()); |
| } else { |
| delegate_->OnStreamReady(job->server_ssl_config(), job->proxy_info(), |
| stream.release()); |