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

Unified Diff: net/spdy/spdy_frame_builder.cc

Issue 202073003: Introduce new SpdyConstants class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/spdy/spdy_framer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_frame_builder.cc
diff --git a/net/spdy/spdy_frame_builder.cc b/net/spdy/spdy_frame_builder.cc
index 1df7d4668b44d170a6696444b9cbfe6eb1af6256..5b084126fd9a2f5487723db083d64407f11a6142 100644
--- a/net/spdy/spdy_frame_builder.cc
+++ b/net/spdy/spdy_frame_builder.cc
@@ -60,14 +60,15 @@ bool SpdyFrameBuilder::Seek(size_t length) {
bool SpdyFrameBuilder::WriteControlFrameHeader(const SpdyFramer& framer,
SpdyFrameType type,
uint8 flags) {
- DCHECK_GE(type, FIRST_CONTROL_TYPE);
- DCHECK_LE(type, LAST_CONTROL_TYPE);
DCHECK_GT(4, framer.protocol_version());
+ DCHECK_NE(-1,
+ SpdyConstants::SerializeFrameType(framer.protocol_version(), type));
bool success = true;
FlagsAndLength flags_length = CreateFlagsAndLength(
flags, capacity_ - framer.GetControlFrameHeaderSize());
success &= WriteUInt16(kControlFlagMask | framer.protocol_version());
- success &= WriteUInt16(type);
+ success &= WriteUInt16(
+ SpdyConstants::SerializeFrameType(framer.protocol_version(), type));
success &= WriteBytes(&flags_length, sizeof(flags_length));
DCHECK_EQ(framer.GetControlFrameHeaderSize(), length());
return success;
@@ -97,8 +98,8 @@ bool SpdyFrameBuilder::WriteFramePrefix(const SpdyFramer& framer,
SpdyFrameType type,
uint8 flags,
SpdyStreamId stream_id) {
- DCHECK_LE(DATA, type);
- DCHECK_GE(LAST_CONTROL_TYPE, type);
+ DCHECK_NE(-1,
+ SpdyConstants::SerializeFrameType(framer.protocol_version(), type));
DCHECK_EQ(0u, stream_id & ~kStreamIdMask);
DCHECK_LE(4, framer.protocol_version());
bool success = true;
@@ -110,7 +111,8 @@ bool SpdyFrameBuilder::WriteFramePrefix(const SpdyFramer& framer,
} else {
success &= WriteUInt16(capacity_ - framer.GetDataFrameMinimumSize());
}
- success &= WriteUInt8(type);
+ success &= WriteUInt8(
+ SpdyConstants::SerializeFrameType(framer.protocol_version(), type));
success &= WriteUInt8(flags);
success &= WriteUInt32(stream_id);
DCHECK_EQ(framer.GetDataFrameMinimumSize(), length());
« no previous file with comments | « no previous file | net/spdy/spdy_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698