| Index: net/http/http_stream_factory_impl_job_controller.cc
|
| diff --git a/net/http/http_stream_factory_impl_job_controller.cc b/net/http/http_stream_factory_impl_job_controller.cc
|
| index 0103707961050f5ce6842015009a5a84de3ab0ca..4dffae39653530325de70e5db3160d67ca1f539d 100644
|
| --- a/net/http/http_stream_factory_impl_job_controller.cc
|
| +++ b/net/http/http_stream_factory_impl_job_controller.cc
|
| @@ -40,39 +40,55 @@ HttpStreamFactoryImpl::JobController::JobController(
|
| HttpStreamFactoryImpl* factory,
|
| HttpStreamRequest::Delegate* delegate,
|
| HttpNetworkSession* session,
|
| - JobFactory* job_factory)
|
| + JobFactory* job_factory,
|
| + bool is_preconnect)
|
| : factory_(factory),
|
| session_(session),
|
| job_factory_(job_factory),
|
| request_(nullptr),
|
| delegate_(delegate),
|
| - is_preconnect_(false),
|
| + is_preconnect_(is_preconnect),
|
| alternative_job_failed_(false),
|
| job_bound_(false),
|
| main_job_is_blocked_(false),
|
| bound_job_(nullptr),
|
| can_start_alternative_proxy_job_(false),
|
| privacy_mode_(PRIVACY_MODE_DISABLED),
|
| + net_log_(
|
| + NetLogWithSource::Make(session->net_log(),
|
| + NetLogSourceType::HTTP_STREAM_JOB_CONTROLLER)),
|
| ptr_factory_(this) {
|
| DCHECK(factory);
|
| + net_log_.BeginEvent(
|
| + NetLogEventType::HTTP_STREAM_JOB_CONTROLLER,
|
| + net::NetLog::BoolCallback("is_preconnect", is_preconnect));
|
| }
|
|
|
| HttpStreamFactoryImpl::JobController::~JobController() {
|
| main_job_.reset();
|
| alternative_job_.reset();
|
| bound_job_ = nullptr;
|
| + net_log_.EndEvent(NetLogEventType::HTTP_STREAM_JOB_CONTROLLER);
|
| }
|
|
|
| bool HttpStreamFactoryImpl::JobController::for_websockets() {
|
| return factory_->for_websockets_;
|
| }
|
|
|
| +void HttpStreamFactoryImpl::JobController::AssociateWithNetLogSource(
|
| + const NetLogWithSource& source_net_log) {
|
| + source_net_log.AddEvent(NetLogEventType::HTTP_STREAM_JOB_CONTROLLER_BOUND,
|
| + net_log_.source().ToEventParametersCallback());
|
| + net_log_.AddEvent(NetLogEventType::HTTP_STREAM_JOB_CONTROLLER_BOUND,
|
| + source_net_log.source().ToEventParametersCallback());
|
| +}
|
| +
|
| HttpStreamFactoryImpl::Request* HttpStreamFactoryImpl::JobController::Start(
|
| const HttpRequestInfo& request_info,
|
| HttpStreamRequest::Delegate* delegate,
|
| WebSocketHandshakeStreamBase::CreateHelper*
|
| websocket_handshake_stream_create_helper,
|
| - const NetLogWithSource& net_log,
|
| + const NetLogWithSource& source_net_log,
|
| HttpStreamRequest::StreamType stream_type,
|
| RequestPriority priority,
|
| const SSLConfig& server_ssl_config,
|
| @@ -83,11 +99,11 @@ HttpStreamFactoryImpl::Request* HttpStreamFactoryImpl::JobController::Start(
|
| privacy_mode_ = request_info.privacy_mode;
|
|
|
| request_ = new Request(request_info.url, this, delegate,
|
| - websocket_handshake_stream_create_helper, net_log,
|
| - stream_type);
|
| + websocket_handshake_stream_create_helper,
|
| + source_net_log, stream_type);
|
|
|
| CreateJobs(request_info, priority, server_ssl_config, proxy_ssl_config,
|
| - delegate, stream_type, net_log);
|
| + delegate, stream_type);
|
|
|
| return request_;
|
| }
|
| @@ -99,10 +115,10 @@ void HttpStreamFactoryImpl::JobController::Preconnect(
|
| const SSLConfig& proxy_ssl_config) {
|
| DCHECK(!main_job_);
|
| DCHECK(!alternative_job_);
|
| + DCHECK(is_preconnect_);
|
|
|
| privacy_mode_ = request_info.privacy_mode;
|
|
|
| - is_preconnect_ = true;
|
| HostPortPair destination(HostPortPair::FromURL(request_info.url));
|
| GURL origin_url = ApplyHostMappingRules(request_info.url, &destination);
|
|
|
| @@ -439,7 +455,6 @@ void HttpStreamFactoryImpl::JobController::OnNewSpdySessionReady(
|
| const bool was_alpn_negotiated = job->was_alpn_negotiated();
|
| const NextProto negotiated_protocol = job->negotiated_protocol();
|
| const bool using_spdy = job->using_spdy();
|
| - const NetLogWithSource net_log = job->net_log();
|
|
|
| // Cache this so we can still use it if the JobController is deleted.
|
| HttpStreamFactoryImpl* factory = factory_;
|
| @@ -483,7 +498,7 @@ void HttpStreamFactoryImpl::JobController::OnNewSpdySessionReady(
|
| if (spdy_session && spdy_session->IsAvailable()) {
|
| factory->OnNewSpdySessionReady(spdy_session, direct, used_ssl_config,
|
| used_proxy_info, was_alpn_negotiated,
|
| - negotiated_protocol, using_spdy, net_log);
|
| + negotiated_protocol, using_spdy);
|
| }
|
| if (is_job_orphaned) {
|
| OnOrphanedJobComplete(job);
|
| @@ -621,10 +636,7 @@ void HttpStreamFactoryImpl::JobController::
|
|
|
| const NetLogWithSource* HttpStreamFactoryImpl::JobController::GetNetLog(
|
| Job* job) const {
|
| - if (is_preconnect_ || (job_bound_ && bound_job_ != job))
|
| - return nullptr;
|
| - DCHECK(request_);
|
| - return &request_->net_log();
|
| + return &net_log_;
|
| }
|
|
|
| void HttpStreamFactoryImpl::JobController::MaybeSetWaitTimeForMainJob(
|
| @@ -662,8 +674,7 @@ void HttpStreamFactoryImpl::JobController::CreateJobs(
|
| const SSLConfig& server_ssl_config,
|
| const SSLConfig& proxy_ssl_config,
|
| HttpStreamRequest::Delegate* delegate,
|
| - HttpStreamRequest::StreamType stream_type,
|
| - const NetLogWithSource& net_log) {
|
| + HttpStreamRequest::StreamType stream_type) {
|
| DCHECK(!main_job_);
|
| DCHECK(!alternative_job_);
|
| HostPortPair destination(HostPortPair::FromURL(request_info.url));
|
| @@ -671,7 +682,7 @@ void HttpStreamFactoryImpl::JobController::CreateJobs(
|
|
|
| main_job_.reset(job_factory_->CreateJob(
|
| this, MAIN, session_, request_info, priority, server_ssl_config,
|
| - proxy_ssl_config, destination, origin_url, net_log.net_log()));
|
| + proxy_ssl_config, destination, origin_url, net_log_.net_log()));
|
| AttachJob(main_job_.get());
|
|
|
| // Create an alternative job if alternative service is set up for this domain.
|
| @@ -692,7 +703,7 @@ void HttpStreamFactoryImpl::JobController::CreateJobs(
|
| alternative_job_.reset(job_factory_->CreateJob(
|
| this, ALTERNATIVE, session_, request_info, priority, server_ssl_config,
|
| proxy_ssl_config, alternative_destination, origin_url,
|
| - alternative_service, net_log.net_log()));
|
| + alternative_service, net_log_.net_log()));
|
| AttachJob(alternative_job_.get());
|
|
|
| main_job_is_blocked_ = true;
|
|
|