| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 RequestSet& request_set = | 243 RequestSet& request_set = |
| 244 spdy_session_request_map[*spdy_session_key_]; | 244 spdy_session_request_map[*spdy_session_key_]; |
| 245 DCHECK(ContainsKey(request_set, this)); | 245 DCHECK(ContainsKey(request_set, this)); |
| 246 request_set.erase(this); | 246 request_set.erase(this); |
| 247 if (request_set.empty()) | 247 if (request_set.empty()) |
| 248 spdy_session_request_map.erase(*spdy_session_key_); | 248 spdy_session_request_map.erase(*spdy_session_key_); |
| 249 spdy_session_key_.reset(); | 249 spdy_session_key_.reset(); |
| 250 } | 250 } |
| 251 } | 251 } |
| 252 | 252 |
| 253 // TODO(jgraettinger): Currently, HttpStreamFactoryImpl::Job notifies a | |
| 254 // Request that the session is ready, which in turn notifies it's delegate, | |
| 255 // and then it notifies HttpStreamFactoryImpl so that /other/ requests may | |
| 256 // be woken, but only if the spdy_session is still okay. This is tough to grok. | |
| 257 // Instead, see if Job can notify HttpStreamFactoryImpl only, and have one | |
| 258 // path for notifying any requests waiting for the session (including the | |
| 259 // request which spawned it). | |
| 260 void HttpStreamFactoryImpl::Request::OnNewSpdySessionReady( | 253 void HttpStreamFactoryImpl::Request::OnNewSpdySessionReady( |
| 261 Job* job, | 254 Job* job, |
| 262 scoped_ptr<HttpStream> stream, | 255 scoped_ptr<HttpStream> stream, |
| 263 const base::WeakPtr<SpdySession>& spdy_session, | 256 const base::WeakPtr<SpdySession>& spdy_session, |
| 264 bool direct) { | 257 bool direct) { |
| 265 DCHECK(job); | 258 DCHECK(job); |
| 266 DCHECK(job->using_spdy()); | 259 DCHECK(job->using_spdy()); |
| 267 | 260 |
| 268 // Note: |spdy_session| may be NULL. In that case, |delegate_| should still | 261 // Note: |spdy_session| may be NULL. In that case, |delegate_| should still |
| 269 // receive |stream| so the error propogates up correctly, however there is no | 262 // receive |stream| so the error propogates up correctly, however there is no |
| (...skipping 22 matching lines...) Expand all Loading... |
| 292 HttpStreamFactoryImpl* factory = factory_; | 285 HttpStreamFactoryImpl* factory = factory_; |
| 293 if (factory->for_websockets_) { | 286 if (factory->for_websockets_) { |
| 294 // TODO(ricea): Re-instate this code when WebSockets over SPDY is | 287 // TODO(ricea): Re-instate this code when WebSockets over SPDY is |
| 295 // implemented. | 288 // implemented. |
| 296 NOTREACHED(); | 289 NOTREACHED(); |
| 297 } else { | 290 } else { |
| 298 delegate_->OnStreamReady(job->server_ssl_config(), job->proxy_info(), | 291 delegate_->OnStreamReady(job->server_ssl_config(), job->proxy_info(), |
| 299 stream.release()); | 292 stream.release()); |
| 300 } | 293 } |
| 301 // |this| may be deleted after this point. | 294 // |this| may be deleted after this point. |
| 302 if (spdy_session && spdy_session->IsAvailable()) { | 295 if (spdy_session) { |
| 303 factory->OnNewSpdySessionReady(spdy_session, | 296 factory->OnNewSpdySessionReady(spdy_session, |
| 304 direct, | 297 direct, |
| 305 used_ssl_config, | 298 used_ssl_config, |
| 306 used_proxy_info, | 299 used_proxy_info, |
| 307 was_npn_negotiated, | 300 was_npn_negotiated, |
| 308 protocol_negotiated, | 301 protocol_negotiated, |
| 309 using_spdy, | 302 using_spdy, |
| 310 net_log); | 303 net_log); |
| 311 } | 304 } |
| 312 } | 305 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 } | 352 } |
| 360 // We may have other jobs in |jobs_|. For example, if we start multiple jobs | 353 // We may have other jobs in |jobs_|. For example, if we start multiple jobs |
| 361 // for Alternate-Protocol. | 354 // for Alternate-Protocol. |
| 362 OrphanJobsExcept(job); | 355 OrphanJobsExcept(job); |
| 363 return; | 356 return; |
| 364 } | 357 } |
| 365 DCHECK(jobs_.empty()); | 358 DCHECK(jobs_.empty()); |
| 366 } | 359 } |
| 367 | 360 |
| 368 } // namespace net | 361 } // namespace net |
| OLD | NEW |