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 #include <tuple> | 8 #include <tuple> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 return session_->params().host_mapping_rules; | 218 return session_->params().host_mapping_rules; |
219 } | 219 } |
220 | 220 |
221 void HttpStreamFactoryImpl::OnNewSpdySessionReady( | 221 void HttpStreamFactoryImpl::OnNewSpdySessionReady( |
222 const base::WeakPtr<SpdySession>& spdy_session, | 222 const base::WeakPtr<SpdySession>& spdy_session, |
223 bool direct, | 223 bool direct, |
224 const SSLConfig& used_ssl_config, | 224 const SSLConfig& used_ssl_config, |
225 const ProxyInfo& used_proxy_info, | 225 const ProxyInfo& used_proxy_info, |
226 bool was_alpn_negotiated, | 226 bool was_alpn_negotiated, |
227 NextProto negotiated_protocol, | 227 NextProto negotiated_protocol, |
228 bool using_spdy) { | 228 bool using_spdy, |
| 229 NetLogSource source_dependency) { |
229 while (true) { | 230 while (true) { |
230 if (!spdy_session) | 231 if (!spdy_session) |
231 break; | 232 break; |
232 const SpdySessionKey& spdy_session_key = spdy_session->spdy_session_key(); | 233 const SpdySessionKey& spdy_session_key = spdy_session->spdy_session_key(); |
233 // Each iteration may empty out the RequestSet for |spdy_session_key| in | 234 // Each iteration may empty out the RequestSet for |spdy_session_key| in |
234 // |spdy_session_request_map_|. So each time, check for RequestSet and use | 235 // |spdy_session_request_map_|. So each time, check for RequestSet and use |
235 // the first one. | 236 // the first one. |
236 // | 237 // |
237 // TODO(willchan): If it's important, switch RequestSet out for a FIFO | 238 // TODO(willchan): If it's important, switch RequestSet out for a FIFO |
238 // queue (Order by priority first, then FIFO within same priority). Unclear | 239 // queue (Order by priority first, then FIFO within same priority). Unclear |
239 // that it matters here. | 240 // that it matters here. |
240 if (!base::ContainsKey(spdy_session_request_map_, spdy_session_key)) | 241 if (!base::ContainsKey(spdy_session_request_map_, spdy_session_key)) |
241 break; | 242 break; |
242 Request* request = *spdy_session_request_map_[spdy_session_key].begin(); | 243 Request* request = *spdy_session_request_map_[spdy_session_key].begin(); |
243 request->Complete(was_alpn_negotiated, negotiated_protocol, using_spdy); | 244 request->Complete(was_alpn_negotiated, negotiated_protocol, using_spdy); |
244 if (for_websockets_) { | 245 if (for_websockets_) { |
245 // TODO(ricea): Restore this code path when WebSocket over SPDY | 246 // TODO(ricea): Restore this code path when WebSocket over SPDY |
246 // implementation is ready. | 247 // implementation is ready. |
247 NOTREACHED(); | 248 NOTREACHED(); |
248 } else if (request->stream_type() == | 249 } else if (request->stream_type() == |
249 HttpStreamRequest::BIDIRECTIONAL_STREAM) { | 250 HttpStreamRequest::BIDIRECTIONAL_STREAM) { |
250 request->OnBidirectionalStreamImplReady( | 251 request->OnBidirectionalStreamImplReady( |
251 used_ssl_config, used_proxy_info, | 252 used_ssl_config, used_proxy_info, |
252 new BidirectionalStreamSpdyImpl(spdy_session)); | 253 new BidirectionalStreamSpdyImpl(spdy_session, source_dependency)); |
253 } else { | 254 } else { |
254 bool use_relative_url = | 255 bool use_relative_url = |
255 direct || request->url().SchemeIs(url::kHttpsScheme); | 256 direct || request->url().SchemeIs(url::kHttpsScheme); |
256 request->OnStreamReady( | 257 request->OnStreamReady(used_ssl_config, used_proxy_info, |
257 used_ssl_config, used_proxy_info, | 258 new SpdyHttpStream(spdy_session, use_relative_url, |
258 new SpdyHttpStream(spdy_session, use_relative_url)); | 259 source_dependency)); |
259 } | 260 } |
260 } | 261 } |
261 // TODO(mbelshe): Alert other valid requests. | 262 // TODO(mbelshe): Alert other valid requests. |
262 } | 263 } |
263 | 264 |
264 void HttpStreamFactoryImpl::OnJobControllerComplete(JobController* controller) { | 265 void HttpStreamFactoryImpl::OnJobControllerComplete(JobController* controller) { |
265 for (auto it = job_controller_set_.begin(); it != job_controller_set_.end(); | 266 for (auto it = job_controller_set_.begin(); it != job_controller_set_.end(); |
266 ++it) { | 267 ++it) { |
267 if (it->get() == controller) { | 268 if (it->get() == controller) { |
268 job_controller_set_.erase(it); | 269 job_controller_set_.erase(it); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 factory_dump->AddScalar("main_job_count", | 395 factory_dump->AddScalar("main_job_count", |
395 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 396 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
396 main_job_count); | 397 main_job_count); |
397 // The number of preconnect controllers. | 398 // The number of preconnect controllers. |
398 factory_dump->AddScalar("preconnect_count", | 399 factory_dump->AddScalar("preconnect_count", |
399 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 400 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
400 preconnect_controller_count); | 401 preconnect_controller_count); |
401 } | 402 } |
402 | 403 |
403 } // namespace net | 404 } // namespace net |
OLD | NEW |