diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-09 22:24:36 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-09 22:24:36 +0000 |
commit | 98c5e245d9bc1e58374fd6a3b19464364d331645 (patch) | |
tree | 8e6096edbbfe7cd8f88b261a45feac8df993ff09 /net | |
parent | fdd2715c341f77064d125789b50bbfea1d57c755 (diff) | |
download | chromium_src-98c5e245d9bc1e58374fd6a3b19464364d331645.zip chromium_src-98c5e245d9bc1e58374fd6a3b19464364d331645.tar.gz chromium_src-98c5e245d9bc1e58374fd6a3b19464364d331645.tar.bz2 |
Deprecate SpdyControlFrame::size in favor of SpdyControlFrame::kHeaderSize
inherited from the base class.
Manual changes only to spdy_protocol.h, the rest of the CL generated by
running and then manually fixing the one 80 col violation:
perl -pi -e "s/SpdyControlFrame::size\(\)/SpdyControlFrame::kHeaderSize/" $(git grep -l SpdyControlFrame::size)
This is the same as the google-internal CL 25980588
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/8898003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113865 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/spdy/spdy_framer.cc | 13 | ||||
-rw-r--r-- | net/spdy/spdy_framer_test.cc | 2 | ||||
-rw-r--r-- | net/spdy/spdy_protocol.h | 4 | ||||
-rw-r--r-- | net/spdy/spdy_protocol_test.cc | 12 |
4 files changed, 14 insertions, 17 deletions
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc index 9b24ba0..7734eb8 100644 --- a/net/spdy/spdy_framer.cc +++ b/net/spdy/spdy_framer.cc @@ -423,12 +423,12 @@ void SpdyFramer::ProcessControlFrameHeader() { switch (current_control_frame.type()) { case SYN_STREAM: if (current_control_frame.length() < - SpdySynStreamControlFrame::size() - SpdyControlFrame::size()) + SpdySynStreamControlFrame::size() - SpdyControlFrame::kHeaderSize) set_error(SPDY_INVALID_CONTROL_FRAME); break; case SYN_REPLY: if (current_control_frame.length() < - SpdySynReplyControlFrame::size() - SpdyControlFrame::size()) + SpdySynReplyControlFrame::size() - SpdyControlFrame::kHeaderSize) set_error(SPDY_INVALID_CONTROL_FRAME); break; case RST_STREAM: @@ -438,7 +438,7 @@ void SpdyFramer::ProcessControlFrameHeader() { break; case SETTINGS: if (current_control_frame.length() < - SpdySettingsControlFrame::size() - SpdyControlFrame::size()) + SpdySettingsControlFrame::size() - SpdyControlFrame::kHeaderSize) set_error(SPDY_INVALID_CONTROL_FRAME); break; case GOAWAY: @@ -448,17 +448,18 @@ void SpdyFramer::ProcessControlFrameHeader() { break; case HEADERS: if (current_control_frame.length() < - SpdyHeadersControlFrame::size() - SpdyControlFrame::size()) + SpdyHeadersControlFrame::size() - SpdyControlFrame::kHeaderSize) set_error(SPDY_INVALID_CONTROL_FRAME); break; case WINDOW_UPDATE: if (current_control_frame.length() != - SpdyWindowUpdateControlFrame::size() - SpdyControlFrame::size()) + SpdyWindowUpdateControlFrame::size() - + SpdyControlFrame::kHeaderSize) set_error(SPDY_INVALID_CONTROL_FRAME); break; case PING: if (current_control_frame.length() != - SpdyPingControlFrame::size() - SpdyControlFrame::size()) + SpdyPingControlFrame::size() - SpdyControlFrame::kHeaderSize) set_error(SPDY_INVALID_CONTROL_FRAME); break; default: diff --git a/net/spdy/spdy_framer_test.cc b/net/spdy/spdy_framer_test.cc index 64a4f84..394d7c4 100644 --- a/net/spdy/spdy_framer_test.cc +++ b/net/spdy/spdy_framer_test.cc @@ -1593,7 +1593,7 @@ TEST_F(SpdyFramerTest, ExpandBuffer_HeapSmash) { TestSpdyVisitor visitor; visitor.SimulateInFramer( reinterpret_cast<unsigned char*>(template_frame.get()->data()), - template_frame.get()->length() + SpdyControlFrame::size()); + template_frame.get()->length() + SpdyControlFrame::kHeaderSize); EXPECT_EQ(1, visitor.syn_frame_count_); } } diff --git a/net/spdy/spdy_protocol.h b/net/spdy/spdy_protocol.h index 2519814..f2b5715 100644 --- a/net/spdy/spdy_protocol.h +++ b/net/spdy/spdy_protocol.h @@ -470,10 +470,6 @@ class SpdyControlFrame : public SpdyFrame { return type() == SYN_STREAM || type() == SYN_REPLY || type() == HEADERS; } - // Returns the size of the SpdyFrameBlock structure. - // Note: this is not the size of the SpdyControlFrame class. - static size_t size() { return sizeof(SpdyFrameBlock); } - // The size of the 'Number of Name/Value pairs' field in a Name/Value block. static const size_t kNumNameValuePairsSize = 2; diff --git a/net/spdy/spdy_protocol_test.cc b/net/spdy/spdy_protocol_test.cc index 871ef21..46dd5f0 100644 --- a/net/spdy/spdy_protocol_test.cc +++ b/net/spdy/spdy_protocol_test.cc @@ -50,7 +50,7 @@ namespace { TEST(SpdyProtocolTest, ProtocolConstants) { EXPECT_EQ(8u, SpdyFrame::kHeaderSize); EXPECT_EQ(8u, SpdyDataFrame::size()); - EXPECT_EQ(8u, SpdyControlFrame::size()); + EXPECT_EQ(8u, SpdyControlFrame::kHeaderSize); EXPECT_EQ(18u, SpdySynStreamControlFrame::size()); EXPECT_EQ(14u, SpdySynReplyControlFrame::size()); EXPECT_EQ(16u, SpdyRstStreamControlFrame::size()); @@ -265,7 +265,7 @@ TEST(SpdyProtocolTest, TestSpdySettingsFrame) { } TEST(SpdyProtocolTest, HasHeaderBlock) { - SpdyControlFrame frame(SpdyControlFrame::size()); + SpdyControlFrame frame(SpdyControlFrame::kHeaderSize); for (SpdyControlType type = SYN_STREAM; type < NUM_CONTROL_FRAME_TYPES; type = static_cast<SpdyControlType>(type + 1)) { @@ -308,7 +308,7 @@ TEST(SpdyProtocolDeathTest, TestDataFrame) { TEST(SpdyProtocolDeathTest, TestSpdyControlFrameStreamId) { SpdyControlFrame frame_store(SpdySynStreamControlFrame::size()); - memset(frame_store.data(), '1', SpdyControlFrame::size()); + memset(frame_store.data(), '1', SpdyControlFrame::kHeaderSize); SpdySynStreamControlFrame* frame = reinterpret_cast<SpdySynStreamControlFrame*>(&frame_store); @@ -324,7 +324,7 @@ TEST(SpdyProtocolDeathTest, TestSpdyControlFrameStreamId) { TEST(SpdyProtocolDeathTest, TestSpdyControlFrameVersion) { const unsigned int kVersionMask = 0x7fff; SpdyControlFrame frame(SpdySynStreamControlFrame::size()); - memset(frame.data(), '1', SpdyControlFrame::size()); + memset(frame.data(), '1', SpdyControlFrame::kHeaderSize); // Set the version to various values, and make sure it does not affect the // type. @@ -343,8 +343,8 @@ TEST(SpdyProtocolDeathTest, TestSpdyControlFrameVersion) { } TEST(SpdyProtocolDeathTest, TestSpdyControlFrameType) { - SpdyControlFrame frame(SpdyControlFrame::size()); - memset(frame.data(), 255, SpdyControlFrame::size()); + SpdyControlFrame frame(SpdyControlFrame::kHeaderSize); + memset(frame.data(), 255, SpdyControlFrame::kHeaderSize); // type() should be out of bounds. EXPECT_FALSE(frame.AppearsToBeAValidControlFrame()); |