| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 request_vector.erase(it); | 285 request_vector.erase(it); |
| 286 break; | 286 break; |
| 287 } | 287 } |
| 288 } | 288 } |
| 289 if (request_vector.empty()) | 289 if (request_vector.empty()) |
| 290 http_pipelining_request_map.erase(*http_pipelining_key_); | 290 http_pipelining_request_map.erase(*http_pipelining_key_); |
| 291 http_pipelining_key_.reset(); | 291 http_pipelining_key_.reset(); |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 | 294 |
| 295 // TODO(jgraettinger): Currently, HttpStreamFactoryImpl::Job notifies a |
| 296 // Request that the session is ready, which in turn notifies it's delegate, |
| 297 // and then it notifies HttpStreamFactoryImpl so that /other/ requests may |
| 298 // be woken, but only if the spdy_session is still okay. This is tough to grok. |
| 299 // Instead, see if Job can notify HttpStreamFactoryImpl only, and have one |
| 300 // path for notifying any requests waiting for the session (including the |
| 301 // request which spawned it). |
| 295 void HttpStreamFactoryImpl::Request::OnNewSpdySessionReady( | 302 void HttpStreamFactoryImpl::Request::OnNewSpdySessionReady( |
| 296 Job* job, | 303 Job* job, |
| 297 scoped_ptr<HttpStream> stream, | 304 scoped_ptr<HttpStream> stream, |
| 298 const base::WeakPtr<SpdySession>& spdy_session, | 305 const base::WeakPtr<SpdySession>& spdy_session, |
| 299 bool direct) { | 306 bool direct) { |
| 300 DCHECK(job); | 307 DCHECK(job); |
| 301 DCHECK(job->using_spdy()); | 308 DCHECK(job->using_spdy()); |
| 302 | 309 |
| 303 // Note: |spdy_session| may be NULL. In that case, |delegate_| should still | 310 // Note: |spdy_session| may be NULL. In that case, |delegate_| should still |
| 304 // receive |stream| so the error propogates up correctly, however there is no | 311 // receive |stream| so the error propogates up correctly, however there is no |
| (...skipping 22 matching lines...) Expand all Loading... |
| 327 HttpStreamFactoryImpl* factory = factory_; | 334 HttpStreamFactoryImpl* factory = factory_; |
| 328 if (factory->for_websockets_) { | 335 if (factory->for_websockets_) { |
| 329 // TODO(ricea): Re-instate this code when WebSockets over SPDY is | 336 // TODO(ricea): Re-instate this code when WebSockets over SPDY is |
| 330 // implemented. | 337 // implemented. |
| 331 NOTREACHED(); | 338 NOTREACHED(); |
| 332 } else { | 339 } else { |
| 333 delegate_->OnStreamReady(job->server_ssl_config(), job->proxy_info(), | 340 delegate_->OnStreamReady(job->server_ssl_config(), job->proxy_info(), |
| 334 stream.release()); | 341 stream.release()); |
| 335 } | 342 } |
| 336 // |this| may be deleted after this point. | 343 // |this| may be deleted after this point. |
| 337 if (spdy_session) { | 344 if (spdy_session && spdy_session->IsAvailable()) { |
| 338 factory->OnNewSpdySessionReady(spdy_session, | 345 factory->OnNewSpdySessionReady(spdy_session, |
| 339 direct, | 346 direct, |
| 340 used_ssl_config, | 347 used_ssl_config, |
| 341 used_proxy_info, | 348 used_proxy_info, |
| 342 was_npn_negotiated, | 349 was_npn_negotiated, |
| 343 protocol_negotiated, | 350 protocol_negotiated, |
| 344 using_spdy, | 351 using_spdy, |
| 345 net_log); | 352 net_log); |
| 346 } | 353 } |
| 347 } | 354 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 } | 403 } |
| 397 // We may have other jobs in |jobs_|. For example, if we start multiple jobs | 404 // We may have other jobs in |jobs_|. For example, if we start multiple jobs |
| 398 // for Alternate-Protocol. | 405 // for Alternate-Protocol. |
| 399 OrphanJobsExcept(job); | 406 OrphanJobsExcept(job); |
| 400 return; | 407 return; |
| 401 } | 408 } |
| 402 DCHECK(jobs_.empty()); | 409 DCHECK(jobs_.empty()); |
| 403 } | 410 } |
| 404 | 411 |
| 405 } // namespace net | 412 } // namespace net |
| OLD | NEW |