OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/http/http_stream_factory_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "net/base/net_util.h" | 11 #include "net/base/net_util.h" |
12 #include "net/http/http_network_session.h" | 12 #include "net/http/http_network_session.h" |
13 #include "net/http/http_server_properties.h" | 13 #include "net/http/http_server_properties.h" |
14 #include "net/http/http_stream_factory_impl_job.h" | 14 #include "net/http/http_stream_factory_impl_job.h" |
15 #include "net/http/http_stream_factory_impl_request.h" | 15 #include "net/http/http_stream_factory_impl_request.h" |
16 #include "net/log/net_log.h" | 16 #include "net/log/net_log.h" |
17 #include "net/net_features.h" | |
mmenke
2016/01/04 21:50:36
Why is this needed here, but not in, say, net/http
mef
2016/01/04 21:55:33
I think your understanding matches mine. :)
Witho
| |
17 #include "net/quic/quic_server_id.h" | 18 #include "net/quic/quic_server_id.h" |
18 #include "net/spdy/spdy_http_stream.h" | 19 #include "net/spdy/spdy_http_stream.h" |
19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
20 | 21 |
21 #if defined(ENABLE_BIDIRECTIONAL_STREAM) | 22 #if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM) |
22 #include "net/spdy/bidirectional_stream_spdy_job.h" | 23 #include "net/spdy/bidirectional_stream_spdy_job.h" |
23 #endif | 24 #endif |
24 | 25 |
25 namespace net { | 26 namespace net { |
26 | 27 |
27 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session, | 28 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session, |
28 bool for_websockets) | 29 bool for_websockets) |
29 : session_(session), | 30 : session_(session), |
30 for_websockets_(for_websockets) {} | 31 for_websockets_(for_websockets) {} |
31 | 32 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 const HttpRequestInfo& request_info, | 85 const HttpRequestInfo& request_info, |
85 RequestPriority priority, | 86 RequestPriority priority, |
86 const SSLConfig& server_ssl_config, | 87 const SSLConfig& server_ssl_config, |
87 const SSLConfig& proxy_ssl_config, | 88 const SSLConfig& proxy_ssl_config, |
88 HttpStreamRequest::Delegate* delegate, | 89 HttpStreamRequest::Delegate* delegate, |
89 const BoundNetLog& net_log) { | 90 const BoundNetLog& net_log) { |
90 DCHECK(!for_websockets_); | 91 DCHECK(!for_websockets_); |
91 DCHECK(request_info.url.SchemeIs(url::kHttpsScheme)); | 92 DCHECK(request_info.url.SchemeIs(url::kHttpsScheme)); |
92 | 93 |
93 // TODO(xunjieli): Create QUIC's version of BidirectionalStreamJob. | 94 // TODO(xunjieli): Create QUIC's version of BidirectionalStreamJob. |
94 #if defined(ENABLE_BIDIRECTIONAL_STREAM) | 95 #if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM) |
95 Request* request = | 96 Request* request = |
96 new Request(request_info.url, this, delegate, nullptr, net_log, | 97 new Request(request_info.url, this, delegate, nullptr, net_log, |
97 Request::BIDIRECTIONAL_STREAM_SPDY_JOB); | 98 Request::BIDIRECTIONAL_STREAM_SPDY_JOB); |
98 Job* job = new Job(this, session_, request_info, priority, server_ssl_config, | 99 Job* job = new Job(this, session_, request_info, priority, server_ssl_config, |
99 proxy_ssl_config, net_log.net_log()); | 100 proxy_ssl_config, net_log.net_log()); |
100 request->AttachJob(job); | 101 request->AttachJob(job); |
101 | 102 |
102 job->Start(request); | 103 job->Start(request); |
103 return request; | 104 return request; |
104 | 105 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
299 // that it matters here. | 300 // that it matters here. |
300 if (!ContainsKey(spdy_session_request_map_, spdy_session_key)) | 301 if (!ContainsKey(spdy_session_request_map_, spdy_session_key)) |
301 break; | 302 break; |
302 Request* request = *spdy_session_request_map_[spdy_session_key].begin(); | 303 Request* request = *spdy_session_request_map_[spdy_session_key].begin(); |
303 request->Complete(was_npn_negotiated, protocol_negotiated, using_spdy); | 304 request->Complete(was_npn_negotiated, protocol_negotiated, using_spdy); |
304 if (for_websockets_) { | 305 if (for_websockets_) { |
305 // TODO(ricea): Restore this code path when WebSocket over SPDY | 306 // TODO(ricea): Restore this code path when WebSocket over SPDY |
306 // implementation is ready. | 307 // implementation is ready. |
307 NOTREACHED(); | 308 NOTREACHED(); |
308 } else if (request->for_bidirectional()) { | 309 } else if (request->for_bidirectional()) { |
309 #if defined(ENABLE_BIDIRECTIONAL_STREAM) | 310 #if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM) |
310 request->OnBidirectionalStreamJobReady( | 311 request->OnBidirectionalStreamJobReady( |
311 nullptr, used_ssl_config, used_proxy_info, | 312 nullptr, used_ssl_config, used_proxy_info, |
312 new BidirectionalStreamSpdyJob(spdy_session)); | 313 new BidirectionalStreamSpdyJob(spdy_session)); |
313 #else | 314 #else |
314 DCHECK(false); | 315 DCHECK(false); |
315 #endif | 316 #endif |
316 } else { | 317 } else { |
317 bool use_relative_url = direct || request->url().SchemeIs("https"); | 318 bool use_relative_url = direct || request->url().SchemeIs("https"); |
318 request->OnStreamReady( | 319 request->OnStreamReady( |
319 nullptr, used_ssl_config, used_proxy_info, | 320 nullptr, used_ssl_config, used_proxy_info, |
320 new SpdyHttpStream(spdy_session, use_relative_url)); | 321 new SpdyHttpStream(spdy_session, use_relative_url)); |
321 } | 322 } |
322 } | 323 } |
323 // TODO(mbelshe): Alert other valid requests. | 324 // TODO(mbelshe): Alert other valid requests. |
324 } | 325 } |
325 | 326 |
326 void HttpStreamFactoryImpl::OnOrphanedJobComplete(const Job* job) { | 327 void HttpStreamFactoryImpl::OnOrphanedJobComplete(const Job* job) { |
327 orphaned_job_set_.erase(job); | 328 orphaned_job_set_.erase(job); |
328 delete job; | 329 delete job; |
329 } | 330 } |
330 | 331 |
331 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) { | 332 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) { |
332 preconnect_job_set_.erase(job); | 333 preconnect_job_set_.erase(job); |
333 delete job; | 334 delete job; |
334 OnPreconnectsCompleteInternal(); | 335 OnPreconnectsCompleteInternal(); |
335 } | 336 } |
336 | 337 |
337 } // namespace net | 338 } // namespace net |
OLD | NEW |