Commit bd2b815a authored by akalin@chromium.org's avatar akalin@chromium.org

Clean up the last remaining bits of SpdySynReplyControlFrame.

Useful in SPDY 4 development.

This lands server change 42070418.


Review URL: https://chromiumcodereview.appspot.com/12259003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182408 0039d316-1c4b-4281-b951-d872f2087c98
parent d4be6380
......@@ -1020,8 +1020,10 @@ size_t SpdyFramer::ProcessControlFrameHeaderBlock(const char* data,
stream_id = reinterpret_cast<const SpdySynStreamControlFrame*>(
&control_frame)->stream_id();
} else if (control_frame.type() == SYN_REPLY) {
stream_id = reinterpret_cast<const SpdySynReplyControlFrame*>(
&control_frame)->stream_id();
SpdyFrameReader reader(current_frame_buffer_.get(), current_frame_len_);
reader.Seek(SpdyFrame::kHeaderSize); // Seek past frame header.
bool read_successful = reader.ReadUInt31(&stream_id);
DCHECK(read_successful);
} else if (control_frame.type() == HEADERS) {
stream_id = reinterpret_cast<const SpdyHeadersControlFrame*>(
&control_frame)->stream_id();
......@@ -1808,12 +1810,10 @@ bool SpdyFramer::GetFrameBoundaries(const SpdyFrame& frame,
}
break;
case SYN_REPLY:
{
*header_length = GetSynReplyMinimumSize();
*payload_length = frame.length() -
(*header_length - GetControlFrameMinimumSize());
*payload = frame.data() + *header_length;
}
*header_length = GetSynReplyMinimumSize();
*payload_length = frame.length() -
(*header_length - GetControlFrameMinimumSize());
*payload = frame.data() + *header_length;
break;
case HEADERS:
{
......
......@@ -491,11 +491,6 @@ struct SpdySynStreamControlFrameBlock : SpdyFrameBlock {
uint8 credential_slot_;
};
// A SYN_REPLY Control Frame structure.
struct SpdySynReplyControlFrameBlock : SpdyFrameBlock {
SpdyStreamId stream_id_;
};
// A RST_STREAM Control Frame structure.
struct SpdyRstStreamControlFrameBlock : SpdyFrameBlock {
SpdyStreamId stream_id_;
......@@ -1054,49 +1049,6 @@ class SpdySynStreamControlFrame : public SpdyControlFrame {
DISALLOW_COPY_AND_ASSIGN(SpdySynStreamControlFrame);
};
// A SYN_REPLY frame.
class SpdySynReplyControlFrame : public SpdyControlFrame {
public:
SpdySynReplyControlFrame() : SpdyControlFrame(size()) {}
SpdySynReplyControlFrame(char* data, bool owns_buffer)
: SpdyControlFrame(data, owns_buffer) {}
SpdyStreamId stream_id() const {
return ntohl(block()->stream_id_) & kStreamIdMask;
}
int header_block_len() const {
size_t header_block_len = length() - (size() - SpdyFrame::kHeaderSize);
// SPDY 2 had 2 bytes of unused space preceeding the header block.
if (version() < 3) {
header_block_len -= 2;
}
return header_block_len;
}
const char* header_block() const {
const char* header_block = reinterpret_cast<const char*>(block()) + size();
// SPDY 2 had 2 bytes of unused space preceeding the header block.
if (version() < 3) {
header_block += 2;
}
return header_block;
}
// Returns the size of the SpdySynReplyControlFrameBlock structure.
// Note: this is not the size of the SpdySynReplyControlFrame class.
static size_t size() { return sizeof(SpdySynReplyControlFrameBlock); }
private:
const struct SpdySynReplyControlFrameBlock* block() const {
return static_cast<SpdySynReplyControlFrameBlock*>(frame_);
}
struct SpdySynReplyControlFrameBlock* mutable_block() {
return static_cast<SpdySynReplyControlFrameBlock*>(frame_);
}
DISALLOW_COPY_AND_ASSIGN(SpdySynReplyControlFrame);
};
// A RST_STREAM frame.
class SpdyRstStreamControlFrame : public SpdyControlFrame {
public:
......
......@@ -44,7 +44,6 @@ TEST_P(SpdyProtocolTest, ProtocolConstants) {
EXPECT_EQ(8u, SpdyDataFrame::size());
EXPECT_EQ(8u, SpdyControlFrame::kHeaderSize);
EXPECT_EQ(18u, SpdySynStreamControlFrame::size());
EXPECT_EQ(12u, SpdySynReplyControlFrame::size());
EXPECT_EQ(16u, SpdyRstStreamControlFrame::size());
EXPECT_EQ(12u, SpdySettingsControlFrame::size());
EXPECT_EQ(12u, SpdyPingControlFrame::size());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment