Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: net/http/http_stream_factory_impl_request.cc

Issue 18546008: [SPDY] Use WeakPtr<SpdySession> everywhere but SpdySessionPool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test, other minor formatting/comment changes Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 272 }
273 } 273 }
274 if (request_vector.empty()) 274 if (request_vector.empty())
275 http_pipelining_request_map.erase(*http_pipelining_key_); 275 http_pipelining_request_map.erase(*http_pipelining_key_);
276 http_pipelining_key_.reset(); 276 http_pipelining_key_.reset();
277 } 277 }
278 } 278 }
279 279
280 void HttpStreamFactoryImpl::Request::OnNewSpdySessionReady( 280 void HttpStreamFactoryImpl::Request::OnNewSpdySessionReady(
281 Job* job, 281 Job* job,
282 scoped_refptr<SpdySession> spdy_session, 282 const base::WeakPtr<SpdySession>& spdy_session,
283 bool direct) { 283 bool direct) {
284 DCHECK(job); 284 DCHECK(job);
285 DCHECK(job->using_spdy()); 285 DCHECK(job->using_spdy());
286 286
287 // The first case is the usual case. 287 // The first case is the usual case.
288 if (!bound_job_.get()) { 288 if (!bound_job_.get()) {
289 OrphanJobsExcept(job); 289 OrphanJobsExcept(job);
290 } else { // This is the case for HTTPS proxy tunneling. 290 } else { // This is the case for HTTPS proxy tunneling.
291 DCHECK_EQ(bound_job_.get(), job); 291 DCHECK_EQ(bound_job_.get(), job);
292 DCHECK(jobs_.empty()); 292 DCHECK(jobs_.empty());
(...skipping 11 matching lines...) Expand all
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(spdy_session.get(), 314 websocket_stream_factory_->CreateSpdyStream(spdy_session,
315 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.get(), use_relative_url)); 321 new SpdyHttpStream(spdy_session, use_relative_url));
322 } 322 }
323 // |this| may be deleted after this point. 323 // |this| may be deleted after this point.
324 factory->OnNewSpdySessionReady(spdy_session.get(), 324 factory->OnNewSpdySessionReady(spdy_session,
325 direct, 325 direct,
326 used_ssl_config, 326 used_ssl_config,
327 used_proxy_info, 327 used_proxy_info,
328 was_npn_negotiated, 328 was_npn_negotiated,
329 protocol_negotiated, 329 protocol_negotiated,
330 using_spdy, 330 using_spdy,
331 net_log); 331 net_log);
332 } 332 }
333 333
334 void HttpStreamFactoryImpl::Request::OrphanJobsExcept(Job* job) { 334 void HttpStreamFactoryImpl::Request::OrphanJobsExcept(Job* job) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } else if (!bound_job_.get()) { 371 } else if (!bound_job_.get()) {
372 // 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
373 // for Alternate-Protocol. 373 // for Alternate-Protocol.
374 OrphanJobsExcept(job); 374 OrphanJobsExcept(job);
375 } else { 375 } else {
376 DCHECK(jobs_.empty()); 376 DCHECK(jobs_.empty());
377 } 377 }
378 } 378 }
379 379
380 } // namespace net 380 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_request.h ('k') | net/http/http_stream_factory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698