| 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" |
| 11 #include "net/spdy/spdy_http_stream.h" | 11 #include "net/spdy/spdy_http_stream.h" |
| 12 #include "net/spdy/spdy_session.h" | 12 #include "net/spdy/spdy_session.h" |
| 13 | 13 |
| 14 #if defined(ENABLE_BIDIRECTIONAL_STREAM) | 14 #if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM) |
| 15 #include "net/http/bidirectional_stream_job.h" | 15 #include "net/http/bidirectional_stream_job.h" |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 HttpStreamFactoryImpl::Request::Request( | 20 HttpStreamFactoryImpl::Request::Request( |
| 21 const GURL& url, | 21 const GURL& url, |
| 22 HttpStreamFactoryImpl* factory, | 22 HttpStreamFactoryImpl* factory, |
| 23 HttpStreamRequest::Delegate* delegate, | 23 HttpStreamRequest::Delegate* delegate, |
| 24 WebSocketHandshakeStreamBase::CreateHelper* | 24 WebSocketHandshakeStreamBase::CreateHelper* |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // TODO(jgraettinger): Currently, HttpStreamFactoryImpl::Job notifies a | 268 // TODO(jgraettinger): Currently, HttpStreamFactoryImpl::Job notifies a |
| 269 // Request that the session is ready, which in turn notifies it's delegate, | 269 // Request that the session is ready, which in turn notifies it's delegate, |
| 270 // and then it notifies HttpStreamFactoryImpl so that /other/ requests may | 270 // and then it notifies HttpStreamFactoryImpl so that /other/ requests may |
| 271 // be woken, but only if the spdy_session is still okay. This is tough to grok. | 271 // be woken, but only if the spdy_session is still okay. This is tough to grok. |
| 272 // Instead, see if Job can notify HttpStreamFactoryImpl only, and have one | 272 // Instead, see if Job can notify HttpStreamFactoryImpl only, and have one |
| 273 // path for notifying any requests waiting for the session (including the | 273 // path for notifying any requests waiting for the session (including the |
| 274 // request which spawned it). | 274 // request which spawned it). |
| 275 void HttpStreamFactoryImpl::Request::OnNewSpdySessionReady( | 275 void HttpStreamFactoryImpl::Request::OnNewSpdySessionReady( |
| 276 Job* job, | 276 Job* job, |
| 277 scoped_ptr<HttpStream> stream, | 277 scoped_ptr<HttpStream> stream, |
| 278 #if defined(ENABLE_BIDIRECTIONAL_STREAM) | 278 #if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM) |
| 279 scoped_ptr<BidirectionalStreamJob> bidirectional_stream_job, | 279 scoped_ptr<BidirectionalStreamJob> bidirectional_stream_job, |
| 280 #else | 280 #else |
| 281 void* bidirectional_stream_job, | 281 void* bidirectional_stream_job, |
| 282 #endif | 282 #endif |
| 283 const base::WeakPtr<SpdySession>& spdy_session, | 283 const base::WeakPtr<SpdySession>& spdy_session, |
| 284 bool direct) { | 284 bool direct) { |
| 285 DCHECK(job); | 285 DCHECK(job); |
| 286 DCHECK(job->using_spdy()); | 286 DCHECK(job->using_spdy()); |
| 287 | 287 |
| 288 // Note: |spdy_session| may be NULL. In that case, |delegate_| should still | 288 // Note: |spdy_session| may be NULL. In that case, |delegate_| should still |
| (...skipping 21 matching lines...) Expand all Loading... |
| 310 | 310 |
| 311 // Cache this so we can still use it if the request is deleted. | 311 // Cache this so we can still use it if the request is deleted. |
| 312 HttpStreamFactoryImpl* factory = factory_; | 312 HttpStreamFactoryImpl* factory = factory_; |
| 313 if (factory->for_websockets_) { | 313 if (factory->for_websockets_) { |
| 314 // TODO(ricea): Re-instate this code when WebSockets over SPDY is | 314 // TODO(ricea): Re-instate this code when WebSockets over SPDY is |
| 315 // implemented. | 315 // implemented. |
| 316 NOTREACHED(); | 316 NOTREACHED(); |
| 317 } else if (for_bidirectional_) { | 317 } else if (for_bidirectional_) { |
| 318 DCHECK(bidirectional_stream_job); | 318 DCHECK(bidirectional_stream_job); |
| 319 DCHECK(!stream); | 319 DCHECK(!stream); |
| 320 #if defined(ENABLE_BIDIRECTIONAL_STREAM) | 320 #if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM) |
| 321 delegate_->OnBidirectionalStreamJobReady( | 321 delegate_->OnBidirectionalStreamJobReady( |
| 322 job->server_ssl_config(), job->proxy_info(), | 322 job->server_ssl_config(), job->proxy_info(), |
| 323 bidirectional_stream_job.release()); | 323 bidirectional_stream_job.release()); |
| 324 #else | 324 #else |
| 325 NOTREACHED(); | 325 NOTREACHED(); |
| 326 #endif | 326 #endif |
| 327 } else { | 327 } else { |
| 328 DCHECK(!bidirectional_stream_job); | 328 DCHECK(!bidirectional_stream_job); |
| 329 DCHECK(stream); | 329 DCHECK(stream); |
| 330 delegate_->OnStreamReady(job->server_ssl_config(), job->proxy_info(), | 330 delegate_->OnStreamReady(job->server_ssl_config(), job->proxy_info(), |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 } | 415 } |
| 416 // We may have other jobs in |jobs_|. For example, if we start multiple jobs | 416 // We may have other jobs in |jobs_|. For example, if we start multiple jobs |
| 417 // for Alternate-Protocol. | 417 // for Alternate-Protocol. |
| 418 BindJob(job); | 418 BindJob(job); |
| 419 return; | 419 return; |
| 420 } | 420 } |
| 421 DCHECK(jobs_.empty()); | 421 DCHECK(jobs_.empty()); |
| 422 } | 422 } |
| 423 | 423 |
| 424 } // namespace net | 424 } // namespace net |
| OLD | NEW |