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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 306 |
307 Complete(was_npn_negotiated, protocol_negotiated, using_spdy, net_log); | 307 Complete(was_npn_negotiated, protocol_negotiated, using_spdy, net_log); |
308 | 308 |
309 // Cache this so we can still use it if the request is deleted. | 309 // Cache this so we can still use it if the request is deleted. |
310 HttpStreamFactoryImpl* factory = factory_; | 310 HttpStreamFactoryImpl* factory = factory_; |
311 | 311 |
312 bool use_relative_url = direct || url().SchemeIs("https"); | 312 bool use_relative_url = direct || url().SchemeIs("https"); |
313 delegate_->OnStreamReady( | 313 delegate_->OnStreamReady( |
314 job->server_ssl_config(), | 314 job->server_ssl_config(), |
315 job->proxy_info(), | 315 job->proxy_info(), |
316 new SpdyHttpStream(spdy_session, use_relative_url)); | 316 new SpdyHttpStream(spdy_session.get(), use_relative_url)); |
317 // |this| may be deleted after this point. | 317 // |this| may be deleted after this point. |
318 factory->OnSpdySessionReady( | 318 factory->OnSpdySessionReady( |
319 spdy_session, direct, used_ssl_config, used_proxy_info, | 319 spdy_session, direct, used_ssl_config, used_proxy_info, |
320 was_npn_negotiated, protocol_negotiated, using_spdy, net_log); | 320 was_npn_negotiated, protocol_negotiated, using_spdy, net_log); |
321 } | 321 } |
322 | 322 |
323 void HttpStreamFactoryImpl::Request::OrphanJobsExcept(Job* job) { | 323 void HttpStreamFactoryImpl::Request::OrphanJobsExcept(Job* job) { |
324 DCHECK(job); | 324 DCHECK(job); |
325 DCHECK(!bound_job_.get()); | 325 DCHECK(!bound_job_.get()); |
326 DCHECK(ContainsKey(jobs_, job)); | 326 DCHECK(ContainsKey(jobs_, job)); |
327 bound_job_.reset(job); | 327 bound_job_.reset(job); |
328 jobs_.erase(job); | 328 jobs_.erase(job); |
329 factory_->request_map_.erase(job); | 329 factory_->request_map_.erase(job); |
330 | 330 |
331 OrphanJobs(); | 331 OrphanJobs(); |
332 } | 332 } |
333 | 333 |
334 void HttpStreamFactoryImpl::Request::OrphanJobs() { | 334 void HttpStreamFactoryImpl::Request::OrphanJobs() { |
335 RemoveRequestFromSpdySessionRequestMap(); | 335 RemoveRequestFromSpdySessionRequestMap(); |
336 RemoveRequestFromHttpPipeliningRequestMap(); | 336 RemoveRequestFromHttpPipeliningRequestMap(); |
337 | 337 |
338 std::set<Job*> tmp; | 338 std::set<Job*> tmp; |
339 tmp.swap(jobs_); | 339 tmp.swap(jobs_); |
340 | 340 |
341 for (std::set<Job*>::iterator it = tmp.begin(); it != tmp.end(); ++it) | 341 for (std::set<Job*>::iterator it = tmp.begin(); it != tmp.end(); ++it) |
342 factory_->OrphanJob(*it, this); | 342 factory_->OrphanJob(*it, this); |
343 } | 343 } |
344 | 344 |
345 } // namespace net | 345 } // namespace net |
OLD | NEW |