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 6195552031f462bc023d920d8552089f60c4ef80..3556ce5d06b5bd0d2b5078ecbb947d8d7d300341 100644 |
--- a/net/http/http_stream_factory_impl_request.cc |
+++ b/net/http/http_stream_factory_impl_request.cc |
@@ -16,7 +16,8 @@ namespace net { |
HttpStreamFactoryImpl::Request::Request(const GURL& url, |
HttpStreamFactoryImpl* factory, |
HttpStreamRequest::Delegate* delegate, |
- const BoundNetLog& net_log) |
+ const BoundNetLog& net_log, |
+ bool for_websocket) |
: url_(url), |
factory_(factory), |
delegate_(delegate), |
@@ -24,7 +25,8 @@ HttpStreamFactoryImpl::Request::Request(const GURL& url, |
completed_(false), |
was_npn_negotiated_(false), |
protocol_negotiated_(kProtoUnknown), |
- using_spdy_(false) { |
+ using_spdy_(false), |
+ for_websocket_(for_websocket) { |
DCHECK(factory_); |
DCHECK(delegate_); |
@@ -126,6 +128,72 @@ void HttpStreamFactoryImpl::Request::OnStreamReady( |
delegate_->OnStreamReady(used_ssl_config, used_proxy_info, stream); |
} |
+void HttpStreamFactoryImpl::Request::OnSocketReady( |
+ Job* job, |
+ const SSLConfig& used_ssl_config, |
+ const ProxyInfo& used_proxy_info, |
+ ClientSocketHandle* connection) { |
+ DCHECK(connection); |
+ DCHECK(completed_); |
+ |
+ // |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). |
+ if (!job) { |
+ DCHECK(!bound_job_.get()); |
+ DCHECK(!jobs_.empty()); |
+ // NOTE(willchan): We do *NOT* call OrphanJobs() here. The reason is because |
+ // we *WANT* to cancel the unnecessary Jobs from other requests if another |
+ // Job completes first. |
+ // TODO(mbelshe): Revisit this when we implement ip connection pooling of |
+ // SpdySessions. Do we want to orphan the jobs for a different hostname so |
+ // they complete? Or do we want to prevent connecting a new SpdySession if |
+ // we've already got one available for a different hostname where the ip |
+ // address matches up? |
+ } else if (!bound_job_.get()) { |
+ // We may have other jobs in |jobs_|. For example, if we start multiple jobs |
+ // for Alternate-Protocol. |
+ OrphanJobsExcept(job); |
+ } else { |
+ DCHECK(jobs_.empty()); |
+ } |
tyoshino (SeeGerritForStatus)
2013/05/15 07:48:52
factor out common part?
yhirano
2013/05/15 08:21:28
Done.
|
+ delegate_->OnSocketReady(used_ssl_config, used_proxy_info, connection); |
+} |
+ |
+void HttpStreamFactoryImpl::Request::OnSpdySessionReadyForWS( |
+ Job* job, |
+ const SSLConfig& used_ssl_config, |
+ const ProxyInfo& used_proxy_info, |
+ scoped_refptr<SpdySession> session) { |
+ DCHECK(session); |
+ DCHECK(completed_); |
+ |
+ // |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). |
+ if (!job) { |
+ DCHECK(!bound_job_.get()); |
+ DCHECK(!jobs_.empty()); |
+ // NOTE(willchan): We do *NOT* call OrphanJobs() here. The reason is because |
+ // we *WANT* to cancel the unnecessary Jobs from other requests if another |
+ // Job completes first. |
+ // TODO(mbelshe): Revisit this when we implement ip connection pooling of |
+ // SpdySessions. Do we want to orphan the jobs for a different hostname so |
+ // they complete? Or do we want to prevent connecting a new SpdySession if |
+ // we've already got one available for a different hostname where the ip |
+ // address matches up? |
+ } else if (!bound_job_.get()) { |
+ // We may have other jobs in |jobs_|. For example, if we start multiple jobs |
+ // for Alternate-Protocol. |
+ OrphanJobsExcept(job); |
+ } else { |
+ DCHECK(jobs_.empty()); |
+ } |
+ delegate_->OnSpdySessionReady(used_ssl_config, |
+ used_proxy_info, |
+ session.get()); |
+} |
+ |
void HttpStreamFactoryImpl::Request::OnStreamFailed( |
Job* job, |
int status, |
@@ -290,7 +358,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()); |
} |