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

Unified Diff: net/spdy/spdy_http_utils.cc

Issue 10185007: [net] Change order of RequestPriority to natural: higher > lower (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed left-over comment Created 8 years, 8 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 | « net/spdy/buffered_spdy_framer.cc ('k') | net/spdy/spdy_io_buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_http_utils.cc
diff --git a/net/spdy/spdy_http_utils.cc b/net/spdy/spdy_http_utils.cc
index f029a994081425ce2cebb80d2312b88ad007109e..8a516857685587732785501aaa82584340f685f4 100644
--- a/net/spdy/spdy_http_utils.cc
+++ b/net/spdy/spdy_http_utils.cc
@@ -125,21 +125,25 @@ void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
}
+COMPILE_ASSERT(HIGHEST - LOWEST < 4 &&
+ HIGHEST - MINIMUM_PRIORITY < 5,
+ request_priority_incompatible_with_spdy);
+
SpdyPriority ConvertRequestPriorityToSpdyPriority(
const RequestPriority priority,
int protocol_version) {
- DCHECK(HIGHEST <= priority && priority < NUM_PRIORITIES);
+ DCHECK_GE(priority, MINIMUM_PRIORITY);
+ DCHECK_LT(priority, NUM_PRIORITIES);
if (protocol_version == 2) {
// SPDY 2 only has 2 bits of priority, but we have 5 RequestPriorities.
- if (priority < LOWEST) {
- return priority;
+ // Map IDLE => 3, LOWEST => 2, LOW => 2, MEDIUM => 1, HIGHEST => 0.
+ if (priority > LOWEST) {
+ return static_cast<SpdyPriority>(HIGHEST - priority);
} else {
- DCHECK_GE(4, priority);
- return priority - 1;
+ return static_cast<SpdyPriority>(HIGHEST - priority - 1);
}
} else {
- DCHECK_GE(7, priority);
- return priority;
+ return static_cast<SpdyPriority>(HIGHEST - priority);
}
}
« no previous file with comments | « net/spdy/buffered_spdy_framer.cc ('k') | net/spdy/spdy_io_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698