Chromium Code Reviews| 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 ddd5ae65d02293d14cefa236c87f18a3d8902ff8..ebd4c6d3bfbba9dc0da2754c6ca2d95c7b6831cb 100644 |
| --- a/net/http/http_stream_factory_impl_job.cc |
| +++ b/net/http/http_stream_factory_impl_job.cc |
| @@ -28,6 +28,7 @@ |
| #include "net/http/http_server_properties.h" |
| #include "net/http/http_stream_factory.h" |
| #include "net/http/http_stream_factory_impl_request.h" |
| +#include "net/quic/quic_http_stream.h" |
| #include "net/socket/client_socket_handle.h" |
| #include "net/socket/client_socket_pool.h" |
| #include "net/socket/client_socket_pool_manager.h" |
| @@ -89,8 +90,10 @@ HttpStreamFactoryImpl::Job::Job(HttpStreamFactoryImpl* stream_factory, |
| waiting_job_(NULL), |
| using_ssl_(false), |
| using_spdy_(false), |
| + using_quic_(false), |
| force_spdy_always_(HttpStreamFactory::force_spdy_always()), |
| force_spdy_over_ssl_(HttpStreamFactory::force_spdy_over_ssl()), |
| + force_quic_port_(HttpStreamFactory::force_quic_port()), |
| spdy_certificate_error_(OK), |
| establishing_tunnel_(false), |
| was_npn_negotiated_(false), |
| @@ -157,7 +160,7 @@ LoadState HttpStreamFactoryImpl::Job::GetLoadState() const { |
| case STATE_RESOLVE_PROXY_COMPLETE: |
| return session_->proxy_service()->GetLoadState(pac_request_); |
| case STATE_CREATE_STREAM_COMPLETE: |
| - return connection_->GetLoadState(); |
| + return using_quic_ ? LOAD_STATE_CONNECTING : connection_->GetLoadState(); |
| case STATE_INIT_CONNECTION_COMPLETE: |
| return LOAD_STATE_SENDING_REQUEST; |
| default: |
| @@ -638,6 +641,10 @@ bool HttpStreamFactoryImpl::Job::ShouldForceSpdyWithoutSSL() const { |
| return rv && !HttpStreamFactory::HasSpdyExclusion(origin_); |
| } |
| +bool HttpStreamFactoryImpl::Job::ShouldForceQuic() const { |
| + return force_quic_port_ == origin_.port() && proxy_info_.is_direct(); |
|
willchan no longer on Chromium
2012/11/22 03:04:53
FWIW, I read this as forcing all requests to go to
Ryan Hamilton
2012/11/22 23:08:40
I hear ya. Naming is hard. What about --force-qu
willchan no longer on Chromium
2012/12/11 02:02:08
I prefer the latter, but both are better.
|
| +} |
| + |
| int HttpStreamFactoryImpl::Job::DoWaitForJob() { |
| DCHECK(blocking_job_); |
| next_state_ = STATE_WAIT_FOR_JOB_COMPLETE; |
| @@ -660,6 +667,12 @@ int HttpStreamFactoryImpl::Job::DoInitConnection() { |
| using_ssl_ = request_info_.url.SchemeIs("https") || ShouldForceSpdySSL(); |
| using_spdy_ = false; |
| + if (ShouldForceQuic()) { |
| + next_state_ = STATE_CREATE_STREAM; |
| + using_quic_ = true; |
| + return OK; |
| + } |
| + |
| // Check first if we have a spdy session for this group. If so, then go |
| // straight to using that. |
| HostPortProxyPair spdy_session_key = GetSpdySessionKey(); |
| @@ -903,7 +916,7 @@ int HttpStreamFactoryImpl::Job::DoWaitingUserAction(int result) { |
| int HttpStreamFactoryImpl::Job::DoCreateStream() { |
| DCHECK(connection_->socket() || existing_spdy_session_ || |
| - existing_available_pipeline_); |
| + existing_available_pipeline_ || using_quic_); |
| next_state_ = STATE_CREATE_STREAM_COMPLETE; |
| @@ -915,6 +928,12 @@ int HttpStreamFactoryImpl::Job::DoCreateStream() { |
| const ProxyServer& proxy_server = proxy_info_.proxy_server(); |
| + if (using_quic_) { |
| + return session_->quic_stream_factory()->Create( |
| + HostPortProxyPair(origin_, proxy_server), net_log_, &quic_stream_, |
|
willchan no longer on Chromium
2012/11/22 03:04:53
How does cancellation work? Hm, everyone else just
Ryan Hamilton
2012/11/22 23:08:40
Yes, I think your reading is correct. I *think* t
|
| + io_callback_); |
| + } |
| + |
| if (!using_spdy_) { |
| bool using_proxy = (proxy_info_.is_http() || proxy_info_.is_https()) && |
| request_info_.url.SchemeIs("http"); |
| @@ -997,6 +1016,12 @@ int HttpStreamFactoryImpl::Job::DoCreateStreamComplete(int result) { |
| if (result < 0) |
| return result; |
| + if (using_quic_) { |
| + CHECK(quic_stream_); |
| + stream_.reset(quic_stream_); |
| + quic_stream_ = NULL; |
| + } |
| + |
| session_->proxy_service()->ReportSuccess(proxy_info_); |
| next_state_ = STATE_NONE; |
| return OK; |