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

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: Use MINIMUM_PRIORITY instead of 0. 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
Index: net/spdy/spdy_http_utils.cc
diff --git a/net/spdy/spdy_http_utils.cc b/net/spdy/spdy_http_utils.cc
index 0a0df47c4658b80e2e962d2f5bcb0a4cb15f6088..4fae7ecf02b15e9b2807693f830a475b4faaa1d7 100644
--- a/net/spdy/spdy_http_utils.cc
+++ b/net/spdy/spdy_http_utils.cc
@@ -128,18 +128,40 @@ void CreateSpdyHeadersFromHttpRequest(const HttpRequestInfo& info,
SpdyPriority ConvertRequestPriorityToSpdyPriority(
const RequestPriority priority,
int protocol_version) {
- DCHECK(HIGHEST <= priority && priority < NUM_PRIORITIES);
+ DCHECK_GE(priority, MINIMUM_PRIORITY);
Ryan Hamilton 2012/04/23 22:51:05 One minor problem. The CQ is about to land this C
szym 2012/04/24 00:19:31 Thanks for the heads up.
+ DCHECK_LT(priority, NUM_PRIORITIES);
if (protocol_version == 2) {
switch (priority) {
+ case HIGHEST:
+ return SPDY_PRIORITY_HIGHEST;
+ case MEDIUM:
+ return SPDY_PRIORITY_HIGHEST + 1;
+ case LOW:
+ return SPDY_PRIORITY_HIGHEST + 2;
case LOWEST:
return SPDY_PRIORITY_LOWEST - 1;
case IDLE:
return SPDY_PRIORITY_LOWEST;
default:
- return priority;
+ NOTREACHED();
+ return SpdyPriority();
}
} else {
- return priority;
+ switch (priority) {
szym 2012/04/24 00:19:31 Do you think this switch would be better expressed
Ryan Hamilton 2012/04/24 00:42:11 Yup, that sounds great. The SPDY 2 case could be
+ case HIGHEST:
+ return SPDY_PRIORITY_HIGHEST;
+ case MEDIUM:
+ return SPDY_PRIORITY_HIGHEST + 1;
+ case LOW:
+ return SPDY_PRIORITY_HIGHEST + 2;
+ case LOWEST:
+ return SPDY_PRIORITY_HIGHEST + 3;
+ case IDLE:
+ return SPDY_PRIORITY_HIGHEST + 4;
+ default:
+ NOTREACHED();
+ return SpdyPriority();
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698