| 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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "net/http/http_network_session.h" | 13 #include "net/http/http_network_session.h" |
| 14 #include "net/http/http_server_properties.h" | 14 #include "net/http/http_server_properties.h" |
| 15 #include "net/http/http_stream_factory_impl_job.h" | 15 #include "net/http/http_stream_factory_impl_job.h" |
| 16 #include "net/http/http_stream_factory_impl_job_controller.h" | 16 #include "net/http/http_stream_factory_impl_job_controller.h" |
| 17 #include "net/http/http_stream_factory_impl_request.h" | 17 #include "net/http/http_stream_factory_impl_request.h" |
| 18 #include "net/http/transport_security_state.h" | 18 #include "net/http/transport_security_state.h" |
| 19 #include "net/log/net_log.h" | 19 #include "net/log/net_log.h" |
| 20 #include "net/quic/core/quic_server_id.h" | 20 #include "net/quic/core/quic_server_id.h" |
| 21 #include "net/spdy/bidirectional_stream_spdy_impl.h" | 21 #include "net/spdy/bidirectional_stream_spdy_impl.h" |
| 22 #include "net/spdy/spdy_http_stream.h" | 22 #include "net/spdy/spdy_http_stream.h" |
| 23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 24 #include "url/url_constants.h" |
| 24 | 25 |
| 25 namespace net { | 26 namespace net { |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| 28 // Default JobFactory for creating HttpStreamFactoryImpl::Jobs. | 29 // Default JobFactory for creating HttpStreamFactoryImpl::Jobs. |
| 29 class DefaultJobFactory : public HttpStreamFactoryImpl::JobFactory { | 30 class DefaultJobFactory : public HttpStreamFactoryImpl::JobFactory { |
| 30 public: | 31 public: |
| 31 DefaultJobFactory() {} | 32 DefaultJobFactory() {} |
| 32 | 33 |
| 33 ~DefaultJobFactory() override {} | 34 ~DefaultJobFactory() override {} |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 if (for_websockets_) { | 212 if (for_websockets_) { |
| 212 // TODO(ricea): Restore this code path when WebSocket over SPDY | 213 // TODO(ricea): Restore this code path when WebSocket over SPDY |
| 213 // implementation is ready. | 214 // implementation is ready. |
| 214 NOTREACHED(); | 215 NOTREACHED(); |
| 215 } else if (request->stream_type() == | 216 } else if (request->stream_type() == |
| 216 HttpStreamRequest::BIDIRECTIONAL_STREAM) { | 217 HttpStreamRequest::BIDIRECTIONAL_STREAM) { |
| 217 request->OnBidirectionalStreamImplReady( | 218 request->OnBidirectionalStreamImplReady( |
| 218 used_ssl_config, used_proxy_info, | 219 used_ssl_config, used_proxy_info, |
| 219 new BidirectionalStreamSpdyImpl(spdy_session)); | 220 new BidirectionalStreamSpdyImpl(spdy_session)); |
| 220 } else { | 221 } else { |
| 221 bool use_relative_url = direct || request->url().SchemeIs("https"); | 222 bool use_relative_url = |
| 223 direct || request->url().SchemeIs(url::kHttpsScheme); |
| 222 request->OnStreamReady( | 224 request->OnStreamReady( |
| 223 used_ssl_config, used_proxy_info, | 225 used_ssl_config, used_proxy_info, |
| 224 new SpdyHttpStream(spdy_session, use_relative_url)); | 226 new SpdyHttpStream(spdy_session, use_relative_url)); |
| 225 } | 227 } |
| 226 } | 228 } |
| 227 // TODO(mbelshe): Alert other valid requests. | 229 // TODO(mbelshe): Alert other valid requests. |
| 228 } | 230 } |
| 229 | 231 |
| 230 void HttpStreamFactoryImpl::OnJobControllerComplete(JobController* controller) { | 232 void HttpStreamFactoryImpl::OnJobControllerComplete(JobController* controller) { |
| 231 for (auto it = job_controller_set_.begin(); it != job_controller_set_.end(); | 233 for (auto it = job_controller_set_.begin(); it != job_controller_set_.end(); |
| 232 ++it) { | 234 ++it) { |
| 233 if (it->get() == controller) { | 235 if (it->get() == controller) { |
| 234 job_controller_set_.erase(it); | 236 job_controller_set_.erase(it); |
| 235 return; | 237 return; |
| 236 } | 238 } |
| 237 } | 239 } |
| 238 NOTREACHED(); | 240 NOTREACHED(); |
| 239 } | 241 } |
| 240 | 242 |
| 241 } // namespace net | 243 } // namespace net |
| OLD | NEW |