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_request.h" | 5 #include "net/http/http_stream_factory_impl_request.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "net/http/http_stream_factory_impl_job.h" | 10 #include "net/http/http_stream_factory_impl_job.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 Complete(was_npn_negotiated, protocol_negotiated, using_spdy, net_log); | 304 Complete(was_npn_negotiated, protocol_negotiated, using_spdy, net_log); |
305 | 305 |
306 // Cache this so we can still use it if the request is deleted. | 306 // Cache this so we can still use it if the request is deleted. |
307 HttpStreamFactoryImpl* factory = factory_; | 307 HttpStreamFactoryImpl* factory = factory_; |
308 if (factory->for_websockets_) { | 308 if (factory->for_websockets_) { |
309 DCHECK(websocket_stream_factory_); | 309 DCHECK(websocket_stream_factory_); |
310 bool use_relative_url = direct || url().SchemeIs("wss"); | 310 bool use_relative_url = direct || url().SchemeIs("wss"); |
311 delegate_->OnWebSocketStreamReady( | 311 delegate_->OnWebSocketStreamReady( |
312 job->server_ssl_config(), | 312 job->server_ssl_config(), |
313 job->proxy_info(), | 313 job->proxy_info(), |
314 websocket_stream_factory_->CreateSpdyStream( | 314 websocket_stream_factory_->CreateSpdyStream(spdy_session.get(), |
315 spdy_session, use_relative_url)); | 315 use_relative_url)); |
316 } else { | 316 } else { |
317 bool use_relative_url = direct || url().SchemeIs("https"); | 317 bool use_relative_url = direct || url().SchemeIs("https"); |
318 delegate_->OnStreamReady( | 318 delegate_->OnStreamReady( |
319 job->server_ssl_config(), | 319 job->server_ssl_config(), |
320 job->proxy_info(), | 320 job->proxy_info(), |
321 new SpdyHttpStream(spdy_session, use_relative_url)); | 321 new SpdyHttpStream(spdy_session.get(), use_relative_url)); |
322 } | 322 } |
323 // |this| may be deleted after this point. | 323 // |this| may be deleted after this point. |
324 factory->OnNewSpdySessionReady( | 324 factory->OnNewSpdySessionReady(spdy_session.get(), |
325 spdy_session, direct, used_ssl_config, used_proxy_info, | 325 direct, |
326 was_npn_negotiated, protocol_negotiated, using_spdy, net_log); | 326 used_ssl_config, |
| 327 used_proxy_info, |
| 328 was_npn_negotiated, |
| 329 protocol_negotiated, |
| 330 using_spdy, |
| 331 net_log); |
327 } | 332 } |
328 | 333 |
329 void HttpStreamFactoryImpl::Request::OrphanJobsExcept(Job* job) { | 334 void HttpStreamFactoryImpl::Request::OrphanJobsExcept(Job* job) { |
330 DCHECK(job); | 335 DCHECK(job); |
331 DCHECK(!bound_job_.get()); | 336 DCHECK(!bound_job_.get()); |
332 DCHECK(ContainsKey(jobs_, job)); | 337 DCHECK(ContainsKey(jobs_, job)); |
333 bound_job_.reset(job); | 338 bound_job_.reset(job); |
334 jobs_.erase(job); | 339 jobs_.erase(job); |
335 factory_->request_map_.erase(job); | 340 factory_->request_map_.erase(job); |
336 | 341 |
(...skipping 29 matching lines...) Expand all Loading... |
366 } else if (!bound_job_.get()) { | 371 } else if (!bound_job_.get()) { |
367 // We may have other jobs in |jobs_|. For example, if we start multiple jobs | 372 // We may have other jobs in |jobs_|. For example, if we start multiple jobs |
368 // for Alternate-Protocol. | 373 // for Alternate-Protocol. |
369 OrphanJobsExcept(job); | 374 OrphanJobsExcept(job); |
370 } else { | 375 } else { |
371 DCHECK(jobs_.empty()); | 376 DCHECK(jobs_.empty()); |
372 } | 377 } |
373 } | 378 } |
374 | 379 |
375 } // namespace net | 380 } // namespace net |
OLD | NEW |