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

Unified Diff: net/http/http_stream_factory_impl_job_controller.cc

Issue 2690393005: Cap the delay time for the main job when racing with QUIC for delayed (Closed)
Patch Set: sync with master 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
« no previous file with comments | « no previous file | net/http/http_stream_factory_impl_job_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0bb08374dc8e90f0946600b1767183bc6d0f53c6..726691282f152dcbc0ab6a3fba1bff7aebc7ca5c 100644
--- a/net/http/http_stream_factory_impl_job_controller.cc
+++ b/net/http/http_stream_factory_impl_job_controller.cc
@@ -28,6 +28,10 @@
namespace net {
+// The maximum time to wait for the alternate job to complete before resuming
+// the main job.
+const int kMaxDelayTimeForMainJobSecs = 3;
+
std::unique_ptr<base::Value> NetLogJobControllerCallback(
const GURL* url,
bool is_preconnect,
@@ -659,8 +663,10 @@ const NetLogWithSource* HttpStreamFactoryImpl::JobController::GetNetLog(
void HttpStreamFactoryImpl::JobController::MaybeSetWaitTimeForMainJob(
const base::TimeDelta& delay) {
- if (main_job_is_blocked_)
- main_job_wait_time_ = delay;
+ if (main_job_is_blocked_) {
+ main_job_wait_time_ = std::min(
+ delay, base::TimeDelta::FromSeconds(kMaxDelayTimeForMainJobSecs));
+ }
}
bool HttpStreamFactoryImpl::JobController::HasPendingMainJob() const {
« no previous file with comments | « no previous file | net/http/http_stream_factory_impl_job_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698