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

Unified Diff: net/spdy/spdy_http_utils.cc

Issue 1866483002: Add a new priority level, THROTTLED, below IDLE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjusted predictor priorities. Created 4 years, 2 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/spdy/spdy_http_utils.cc
diff --git a/net/spdy/spdy_http_utils.cc b/net/spdy/spdy_http_utils.cc
index 1213f1ca8c238fb3fba68a1d84e38ad87a57ec39..f285e8430e1bb864352d14e9c92e1b7bc20b41e2 100644
--- a/net/spdy/spdy_http_utils.cc
+++ b/net/spdy/spdy_http_utils.cc
@@ -127,22 +127,25 @@ void CreateSpdyHeadersFromHttpResponse(
}
}
-static_assert(HIGHEST - LOWEST < 4 && HIGHEST - MINIMUM_PRIORITY < 5,
+static_assert(HIGHEST - LOWEST < 4 && HIGHEST - MINIMUM_PRIORITY < 6,
"request priority incompatible with spdy");
SpdyPriority ConvertRequestPriorityToSpdyPriority(
const RequestPriority priority) {
DCHECK_GE(priority, MINIMUM_PRIORITY);
DCHECK_LE(priority, MAXIMUM_PRIORITY);
- return static_cast<SpdyPriority>(MAXIMUM_PRIORITY - priority);
+ return static_cast<SpdyPriority>(MAXIMUM_PRIORITY - priority +
+ kV3HighestPriority);
}
NET_EXPORT_PRIVATE RequestPriority
ConvertSpdyPriorityToRequestPriority(SpdyPriority priority) {
// Handle invalid values gracefully.
- // Note that SpdyPriority is not an enum, hence the magic constants.
- return (priority >= 5) ?
- IDLE : static_cast<RequestPriority>(4 - priority);
+ return ((priority - kV3HighestPriority) >
+ (MAXIMUM_PRIORITY - MINIMUM_PRIORITY))
+ ? IDLE
+ : static_cast<RequestPriority>(MAXIMUM_PRIORITY -
+ (priority - kV3HighestPriority));
}
NET_EXPORT_PRIVATE void ConvertHeaderBlockToHttpRequestHeaders(

Powered by Google App Engine
This is Rietveld 408576698