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

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

Issue 2351513002: net: rename BoundNetLog to NetLogWithSource (Closed)
Patch Set: REBASE Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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_job_controller.h" 5 #include "net/http/http_stream_factory_impl_job_controller.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 bool HttpStreamFactoryImpl::JobController::for_websockets() { 56 bool HttpStreamFactoryImpl::JobController::for_websockets() {
57 return factory_->for_websockets_; 57 return factory_->for_websockets_;
58 } 58 }
59 59
60 HttpStreamFactoryImpl::Request* HttpStreamFactoryImpl::JobController::Start( 60 HttpStreamFactoryImpl::Request* HttpStreamFactoryImpl::JobController::Start(
61 const HttpRequestInfo& request_info, 61 const HttpRequestInfo& request_info,
62 HttpStreamRequest::Delegate* delegate, 62 HttpStreamRequest::Delegate* delegate,
63 WebSocketHandshakeStreamBase::CreateHelper* 63 WebSocketHandshakeStreamBase::CreateHelper*
64 websocket_handshake_stream_create_helper, 64 websocket_handshake_stream_create_helper,
65 const BoundNetLog& net_log, 65 const NetLogWithSource& net_log,
66 HttpStreamRequest::StreamType stream_type, 66 HttpStreamRequest::StreamType stream_type,
67 RequestPriority priority, 67 RequestPriority priority,
68 const SSLConfig& server_ssl_config, 68 const SSLConfig& server_ssl_config,
69 const SSLConfig& proxy_ssl_config) { 69 const SSLConfig& proxy_ssl_config) {
70 DCHECK(factory_); 70 DCHECK(factory_);
71 DCHECK(!request_); 71 DCHECK(!request_);
72 72
73 request_ = new Request(request_info.url, this, delegate, 73 request_ = new Request(request_info.url, this, delegate,
74 websocket_handshake_stream_create_helper, net_log, 74 websocket_handshake_stream_create_helper, net_log,
75 stream_type); 75 stream_type);
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 DCHECK(job->using_spdy()); 406 DCHECK(job->using_spdy());
407 407
408 bool is_job_orphaned = job_bound_ && bound_job_ != job; 408 bool is_job_orphaned = job_bound_ && bound_job_ != job;
409 409
410 // Cache these values in case the job gets deleted. 410 // Cache these values in case the job gets deleted.
411 const SSLConfig used_ssl_config = job->server_ssl_config(); 411 const SSLConfig used_ssl_config = job->server_ssl_config();
412 const ProxyInfo used_proxy_info = job->proxy_info(); 412 const ProxyInfo used_proxy_info = job->proxy_info();
413 const bool was_npn_negotiated = job->was_npn_negotiated(); 413 const bool was_npn_negotiated = job->was_npn_negotiated();
414 const NextProto negotiated_protocol = job->negotiated_protocol(); 414 const NextProto negotiated_protocol = job->negotiated_protocol();
415 const bool using_spdy = job->using_spdy(); 415 const bool using_spdy = job->using_spdy();
416 const BoundNetLog net_log = job->net_log(); 416 const NetLogWithSource net_log = job->net_log();
417 417
418 // Cache this so we can still use it if the JobController is deleted. 418 // Cache this so we can still use it if the JobController is deleted.
419 HttpStreamFactoryImpl* factory = factory_; 419 HttpStreamFactoryImpl* factory = factory_;
420 420
421 // Notify |request_|. 421 // Notify |request_|.
422 if (!is_preconnect_ && !is_job_orphaned) { 422 if (!is_preconnect_ && !is_job_orphaned) {
423 if (job->job_type() == MAIN && alternative_job_failed_) 423 if (job->job_type() == MAIN && alternative_job_failed_)
424 ReportBrokenAlternativeService(); 424 ReportBrokenAlternativeService();
425 425
426 DCHECK(request_); 426 DCHECK(request_);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 DCHECK(base::ContainsKey(spdy_session_request_map, *spdy_session_key)); 586 DCHECK(base::ContainsKey(spdy_session_request_map, *spdy_session_key));
587 RequestSet& request_set = spdy_session_request_map[*spdy_session_key]; 587 RequestSet& request_set = spdy_session_request_map[*spdy_session_key];
588 DCHECK(base::ContainsKey(request_set, request_)); 588 DCHECK(base::ContainsKey(request_set, request_));
589 request_set.erase(request_); 589 request_set.erase(request_);
590 if (request_set.empty()) 590 if (request_set.empty())
591 spdy_session_request_map.erase(*spdy_session_key); 591 spdy_session_request_map.erase(*spdy_session_key);
592 request_->ResetSpdySessionKey(); 592 request_->ResetSpdySessionKey();
593 } 593 }
594 } 594 }
595 595
596 const BoundNetLog* HttpStreamFactoryImpl::JobController::GetNetLog( 596 const NetLogWithSource* HttpStreamFactoryImpl::JobController::GetNetLog(
597 Job* job) const { 597 Job* job) const {
598 if (is_preconnect_ || (job_bound_ && bound_job_ != job)) 598 if (is_preconnect_ || (job_bound_ && bound_job_ != job))
599 return nullptr; 599 return nullptr;
600 DCHECK(request_); 600 DCHECK(request_);
601 return &request_->net_log(); 601 return &request_->net_log();
602 } 602 }
603 603
604 void HttpStreamFactoryImpl::JobController::MaybeSetWaitTimeForMainJob( 604 void HttpStreamFactoryImpl::JobController::MaybeSetWaitTimeForMainJob(
605 const base::TimeDelta& delay) { 605 const base::TimeDelta& delay) {
606 if (main_job_is_blocked_) 606 if (main_job_is_blocked_)
607 main_job_wait_time_ = delay; 607 main_job_wait_time_ = delay;
608 } 608 }
609 609
610 WebSocketHandshakeStreamBase::CreateHelper* HttpStreamFactoryImpl:: 610 WebSocketHandshakeStreamBase::CreateHelper* HttpStreamFactoryImpl::
611 JobController::websocket_handshake_stream_create_helper() { 611 JobController::websocket_handshake_stream_create_helper() {
612 DCHECK(request_); 612 DCHECK(request_);
613 return request_->websocket_handshake_stream_create_helper(); 613 return request_->websocket_handshake_stream_create_helper();
614 } 614 }
615 615
616 void HttpStreamFactoryImpl::JobController::CreateJobs( 616 void HttpStreamFactoryImpl::JobController::CreateJobs(
617 const HttpRequestInfo& request_info, 617 const HttpRequestInfo& request_info,
618 RequestPriority priority, 618 RequestPriority priority,
619 const SSLConfig& server_ssl_config, 619 const SSLConfig& server_ssl_config,
620 const SSLConfig& proxy_ssl_config, 620 const SSLConfig& proxy_ssl_config,
621 HttpStreamRequest::Delegate* delegate, 621 HttpStreamRequest::Delegate* delegate,
622 HttpStreamRequest::StreamType stream_type, 622 HttpStreamRequest::StreamType stream_type,
623 const BoundNetLog& net_log) { 623 const NetLogWithSource& net_log) {
624 DCHECK(!main_job_); 624 DCHECK(!main_job_);
625 DCHECK(!alternative_job_); 625 DCHECK(!alternative_job_);
626 HostPortPair destination(HostPortPair::FromURL(request_info.url)); 626 HostPortPair destination(HostPortPair::FromURL(request_info.url));
627 GURL origin_url = ApplyHostMappingRules(request_info.url, &destination); 627 GURL origin_url = ApplyHostMappingRules(request_info.url, &destination);
628 628
629 main_job_.reset(job_factory_->CreateJob( 629 main_job_.reset(job_factory_->CreateJob(
630 this, MAIN, session_, request_info, priority, server_ssl_config, 630 this, MAIN, session_, request_info, priority, server_ssl_config,
631 proxy_ssl_config, destination, origin_url, net_log.net_log())); 631 proxy_ssl_config, destination, origin_url, net_log.net_log()));
632 AttachJob(main_job_.get()); 632 AttachJob(main_job_.get());
633 633
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 // Check that QUIC is enabled globally, and it is not disabled. 1040 // Check that QUIC is enabled globally, and it is not disabled.
1041 if (!session_->params().enable_quic || 1041 if (!session_->params().enable_quic ||
1042 session_->quic_stream_factory()->IsQuicDisabled()) { 1042 session_->quic_stream_factory()->IsQuicDisabled()) {
1043 return false; 1043 return false;
1044 } 1044 }
1045 } 1045 }
1046 1046
1047 return true; 1047 return true;
1048 } 1048 }
1049 } 1049 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698