Index: net/http/http_stream_factory_impl_job.cc |
diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc |
index 35b04adf441788d6bafe0c6bb8783699f9fbe1ae..179fd9641df971fa4c8c369f0cf356a7054b9fd4 100644 |
--- a/net/http/http_stream_factory_impl_job.cc |
+++ b/net/http/http_stream_factory_impl_job.cc |
@@ -216,7 +216,7 @@ |
spdy_session_direct_(false), |
job_status_(STATUS_RUNNING), |
other_job_status_(STATUS_RUNNING), |
- stream_type_(HttpStreamRequest::BIDIRECTIONAL_STREAM), |
+ for_bidirectional_(false), |
ptr_factory_(this) { |
DCHECK(stream_factory); |
DCHECK(session); |
@@ -248,8 +248,8 @@ |
void HttpStreamFactoryImpl::Job::Start(Request* request) { |
DCHECK(request); |
request_ = request; |
- // Saves |stream_type_|, since request is nulled when job is orphaned. |
- stream_type_ = request_->stream_type(); |
+ // Saves |for_bidirectional_|, since request is nulled when job is orphaned. |
+ for_bidirectional_ = request_->for_bidirectional(); |
StartInternal(); |
} |
@@ -502,7 +502,7 @@ |
} |
stream_factory_->OnOrphanedJobComplete(this); |
} else { |
- if (stream_type_ == HttpStreamRequest::BIDIRECTIONAL_STREAM) { |
+ if (for_bidirectional_) { |
#if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM) |
DCHECK(bidirectional_stream_job_); |
request_->OnNewSpdySessionReady(this, /*spdy_http_stream=*/nullptr, |
@@ -511,6 +511,7 @@ |
#else |
DCHECK(false); |
#endif |
+ |
} else { |
DCHECK(stream_); |
request_->OnNewSpdySessionReady(this, std::move(stream_), |
@@ -703,7 +704,7 @@ |
base::ThreadTaskRunnerHandle::Get()->PostTask( |
FROM_HERE, base::Bind(&Job::OnWebSocketHandshakeStreamReadyCallback, |
ptr_factory_.GetWeakPtr())); |
- } else if (stream_type_ == HttpStreamRequest::BIDIRECTIONAL_STREAM) { |
+ } else if (for_bidirectional_) { |
#if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM) |
if (!bidirectional_stream_job_) { |
base::ThreadTaskRunnerHandle::Get()->PostTask( |
@@ -1016,6 +1017,7 @@ |
destination = server_; |
ssl_config = &server_ssl_config_; |
} |
+ |
int rv = |
quic_request_.Request(destination, request_info_.privacy_mode, |
ssl_config->GetCertVerifyFlags(), url, |
@@ -1257,23 +1259,7 @@ |
MaybeMarkAlternativeServiceBroken(); |
return result; |
} |
- if (stream_type_ == HttpStreamRequest::BIDIRECTIONAL_STREAM) { |
-#if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM) |
- bidirectional_stream_job_ = quic_request_.CreateBidirectionalStreamJob(); |
- if (!bidirectional_stream_job_) { |
- // Quic session is closed before stream can be created. |
- return ERR_CONNECTION_CLOSED; |
- } |
-#else |
- NOTREACHED(); |
-#endif |
- } else { |
- stream_ = quic_request_.CreateStream(); |
- if (!stream_) { |
- // Quic session is closed before stream can be created. |
- return ERR_CONNECTION_CLOSED; |
- } |
- } |
+ stream_ = quic_request_.ReleaseStream(); |
next_state_ = STATE_NONE; |
return OK; |
} |
@@ -1330,12 +1316,13 @@ |
// implemented. |
if (stream_factory_->for_websockets_) |
return ERR_NOT_IMPLEMENTED; |
- if (stream_type_ == HttpStreamRequest::BIDIRECTIONAL_STREAM) { |
+ if (for_bidirectional_) { |
#if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM) |
+ // TODO(xunjieli): Create QUIC's version of BidirectionalStreamJob. |
bidirectional_stream_job_.reset(new BidirectionalStreamSpdyJob(session)); |
return OK; |
#else |
- NOTREACHED(); |
+ DCHECK(false); |
return ERR_FAILED; |
#endif |
} |