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

Unified Diff: net/http/http_stream_factory_impl_job_controller.cc

Issue 2699433003: Add net-log entries when HttpStream jobs are forced to wait, and when they're delayed and resumed. (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..e7f91fd5f0863341c9d29d4d505cfa508be3267d 100644
--- a/net/http/http_stream_factory_impl_job_controller.cc
+++ b/net/http/http_stream_factory_impl_job_controller.cc
@@ -33,7 +33,7 @@ std::unique_ptr<base::Value> NetLogHttpStreamJobDelayCallback(
base::TimeDelta delay,
NetLogCaptureMode /* capture_mode */) {
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
- dict->SetInteger("resume_after_ms", static_cast<int>(delay.InMilliseconds()));
+ dict->SetInteger("delay_ms", static_cast<int>(delay.InMilliseconds()));
eroman 2017/02/14 21:18:36 Optional: replace this funciton with NetLog::Int64
return std::move(dict);
}
@@ -546,9 +546,20 @@ void HttpStreamFactoryImpl::JobController::AddConnectionAttemptsToRequest(
request_->AddConnectionAttempts(attempts);
}
+void HttpStreamFactoryImpl::JobController::ResumeMainJobLater(
+ const base::TimeDelta& delay) {
+ net_log_.AddEvent(NetLogEventType::HTTP_STREAM_JOB_DELAYED,
+ base::Bind(&NetLogHttpStreamJobDelayCallback, delay));
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&HttpStreamFactoryImpl::JobController::ResumeMainJob,
eroman 2017/02/14 21:18:36 FTR I didn't review this in detail (i.e. wether th
Ryan Hamilton 2017/02/14 21:42:37 *nod* I don't believe I've actually changed any be
+ ptr_factory_.GetWeakPtr()),
+ delay);
+}
+
void HttpStreamFactoryImpl::JobController::ResumeMainJob() {
main_job_->net_log().AddEvent(
- NetLogEventType::HTTP_STREAM_JOB_DELAYED,
+ NetLogEventType::HTTP_STREAM_JOB_RESUMED,
base::Bind(&NetLogHttpStreamJobDelayCallback, main_job_wait_time_));
main_job_->Resume();
@@ -568,11 +579,7 @@ void HttpStreamFactoryImpl::JobController::MaybeResumeMainJob(
if (!main_job_->is_waiting())
return;
- base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&HttpStreamFactoryImpl::JobController::ResumeMainJob,
- ptr_factory_.GetWeakPtr()),
- main_job_wait_time_);
+ ResumeMainJobLater(main_job_wait_time_);
}
void HttpStreamFactoryImpl::JobController::OnConnectionInitialized(Job* job,
@@ -595,12 +602,7 @@ bool HttpStreamFactoryImpl::JobController::ShouldWait(Job* job) {
if (main_job_wait_time_.is_zero())
return false;
- base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&HttpStreamFactoryImpl::JobController::ResumeMainJob,
- ptr_factory_.GetWeakPtr()),
- main_job_wait_time_);
-
+ ResumeMainJobLater(main_job_wait_time_);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698