| 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 cd37e19a13a9d54f45c567a658c57edefaec02ab..563534c7c5c1bd9226d7efa052b14611a27a5b05 100644
|
| --- a/net/http/http_stream_factory_impl_job_controller.cc
|
| +++ b/net/http/http_stream_factory_impl_job_controller.cc
|
| @@ -26,6 +26,7 @@ HttpStreamFactoryImpl::JobController::JobController(
|
| delegate_(delegate),
|
| is_preconnect_(false),
|
| job_bounded_(false),
|
| + blocking_(false),
|
| bound_job_(nullptr) {
|
| DCHECK(factory);
|
| }
|
| @@ -138,6 +139,24 @@ void HttpStreamFactoryImpl::JobController::SetPriority(
|
| }
|
| }
|
|
|
| +int HttpStreamFactoryImpl::JobController::ScheduleJob(Job* job) {
|
| + if ((job->job_type() == ALTERNATIVE || !blocking()) &&
|
| + job->wait_time().is_zero()) {
|
| + // There is no blocking job and there is no |wait_time_|.
|
| + job->SetNextState(STATE_INIT_CONNECTION);
|
| + return OK;
|
| + }
|
| +
|
| + job->SetNextState(STATE_WAIT_FOR_JOB_COMPLETE);
|
| + if (!job->wait_time().is_zero()) {
|
| + // If there is a waiting_time, then resume the job after the wait_time_.
|
| + DCHECK((job->job_type() == ALTERNATIVE || !blocking()));
|
| + job->ResumeAfterDelay();
|
| + }
|
| +
|
| + return ERR_IO_PENDING;
|
| +}
|
| +
|
| void HttpStreamFactoryImpl::JobController::OnStreamReady(
|
| Job* job,
|
| const SSLConfig& used_ssl_config,
|
| @@ -389,6 +408,7 @@ void HttpStreamFactoryImpl::JobController::OnNewSpdySessionReady(
|
|
|
| void HttpStreamFactoryImpl::JobController::OnPreconnectsComplete(Job* job) {
|
| DCHECK_EQ(main_job_.get(), job);
|
| + DCHECK(!bound_job_);
|
| main_job_.reset();
|
| factory_->OnPreconnectsCompleteInternal();
|
| MaybeNotifyFactoryOfCompletion();
|
| @@ -458,6 +478,20 @@ void HttpStreamFactoryImpl::JobController::
|
| }
|
| }
|
|
|
| +void HttpStreamFactoryImpl::JobController::MaybeResumeOtherJob(
|
| + Job* job,
|
| + const base::TimeDelta& delay) {
|
| + if (!blocking_)
|
| + return;
|
| +
|
| + if (job == alternative_job_.get() && main_job_) {
|
| + main_job_->Resume(delay);
|
| + } else if (job != main_job_.get() && job != alternative_job_.get()) {
|
| + NOTREACHED();
|
| + }
|
| + blocking_ = false;
|
| +}
|
| +
|
| const BoundNetLog* HttpStreamFactoryImpl::JobController::GetNetLog(
|
| Job* job) const {
|
| if (is_preconnect_ || (job_bounded_ && bound_job_ != job))
|
| @@ -511,10 +545,7 @@ void HttpStreamFactoryImpl::JobController::CreateJobs(
|
| origin_url, alternative_service, net_log.net_log()));
|
| AttachJob(alternative_job_.get());
|
|
|
| - main_job_->WaitFor(alternative_job_.get());
|
| - // Make sure to wait until we call WaitFor(), before starting
|
| - // |alternative_job|, otherwise |alternative_job| will not notify |job|
|
| - // appropriately.
|
| + blocking_ = true;
|
| alternative_job_->Start(request_->stream_type());
|
| }
|
| // Even if |alternative_job| has already finished, it will not have notified
|
|
|