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

Unified Diff: net/http/http_stream_factory_impl_job_controller.cc

Issue 2693043008: Resume the main job immediately when QUIC job fails, not wait for the head start timer to exprie (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
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 ac3f92e498b2418ffce4949bfada7e8bed73d558..0629eb27db47a292876e54dec69dcb5dced82cfd 100644
--- a/net/http/http_stream_factory_impl_job_controller.cc
+++ b/net/http/http_stream_factory_impl_job_controller.cc
@@ -63,6 +63,7 @@ HttpStreamFactoryImpl::JobController::JobController(
alternative_job_net_error_(OK),
job_bound_(false),
main_job_is_blocked_(false),
+ main_job_is_resumed_(false),
bound_job_(nullptr),
can_start_alternative_proxy_job_(false),
privacy_mode_(PRIVACY_MODE_DISABLED),
@@ -547,6 +548,10 @@ void HttpStreamFactoryImpl::JobController::AddConnectionAttemptsToRequest(
}
void HttpStreamFactoryImpl::JobController::ResumeMainJob() {
+ if (main_job_is_resumed_)
+ return;
+
+ main_job_is_resumed_ = true;
main_job_->net_log().AddEvent(
NetLogEventType::HTTP_STREAM_JOB_DELAYED,
base::Bind(&NetLogHttpStreamJobDelayCallback, main_job_wait_time_));
@@ -558,21 +563,30 @@ void HttpStreamFactoryImpl::JobController::ResumeMainJob() {
void HttpStreamFactoryImpl::JobController::MaybeResumeMainJob(
Job* job,
const base::TimeDelta& delay) {
+ DCHECK(delay == base::TimeDelta() || delay == main_job_wait_time_);
DCHECK(job == main_job_.get() || job == alternative_job_.get());
- if (!main_job_is_blocked_ || job != alternative_job_.get() || !main_job_)
+ if (main_job_is_resumed_ || job != alternative_job_.get() || !main_job_)
return;
- main_job_is_blocked_ = false;
-
- if (!main_job_->is_waiting())
+ if (!main_job_->is_waiting()) {
+ main_job_is_blocked_ = false;
return;
+ }
+
+ if (!main_job_is_blocked_) {
+ // A task has been posted earlier to resume the main job, though not
+ // executed. This task will now resume the main job immediately.
+ main_job_wait_time_ = base::TimeDelta();
+ DCHECK(delay == base::TimeDelta());
Ryan Hamilton 2017/02/15 00:07:02 I don't quite understand this block. I would think
Zhongyi Shi 2017/02/15 00:26:58 Done.
+ }
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
base::Bind(&HttpStreamFactoryImpl::JobController::ResumeMainJob,
ptr_factory_.GetWeakPtr()),
- main_job_wait_time_);
+ delay);
+ main_job_is_blocked_ = false;
}
void HttpStreamFactoryImpl::JobController::OnConnectionInitialized(Job* job,

Powered by Google App Engine
This is Rietveld 408576698