diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-27 05:29:55 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-27 05:29:55 +0000 |
commit | b28f44a5925cf7d14eac05a2eb104781b4b05ff0 (patch) | |
tree | 037d2dafb0c745ee331183a209c73885c741e44d | |
parent | 4e080105f98d7ae3946469caf2fff1ff896d959d (diff) | |
download | chromium_src-b28f44a5925cf7d14eac05a2eb104781b4b05ff0.zip chromium_src-b28f44a5925cf7d14eac05a2eb104781b4b05ff0.tar.gz chromium_src-b28f44a5925cf7d14eac05a2eb104781b4b05ff0.tar.bz2 |
Remove SpdyFrameBlock structure, the last remaining "on-the-wire" structs.
This lands server change 43076286.
Review URL: https://chromiumcodereview.appspot.com/12342005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184885 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/spdy/spdy_frame_builder.cc | 6 | ||||
-rw-r--r-- | net/spdy/spdy_protocol.h | 47 | ||||
-rw-r--r-- | net/spdy/spdy_protocol_test.cc | 1 |
3 files changed, 10 insertions, 44 deletions
diff --git a/net/spdy/spdy_frame_builder.cc b/net/spdy/spdy_frame_builder.cc index 3c1a91a..29f365b 100644 --- a/net/spdy/spdy_frame_builder.cc +++ b/net/spdy/spdy_frame_builder.cc @@ -14,6 +14,12 @@ namespace net { namespace { +// A special structure for the 8 bit flags and 24 bit length fields. +union FlagsAndLength { + uint8 flags_[4]; // 8 bits + uint32 length_; // 24 bits +}; + // Creates a FlagsAndLength. FlagsAndLength CreateFlagsAndLength(uint8 flags, size_t length) { DCHECK_EQ(0u, length & ~static_cast<size_t>(kLengthMask)); diff --git a/net/spdy/spdy_protocol.h b/net/spdy/spdy_protocol.h index 812295f..5b6ddbd 100644 --- a/net/spdy/spdy_protocol.h +++ b/net/spdy/spdy_protocol.h @@ -459,36 +459,6 @@ typedef std::map<std::string, std::string> SpdyNameValueBlock; typedef uint32 SpdyPingId; -// ------------------------------------------------------------------------- -// These structures mirror the protocol structure definitions. - -// For the control data structures, we pack so that sizes match the -// protocol over-the-wire sizes. -#pragma pack(push) -#pragma pack(1) - -// A special structure for the 8 bit flags and 24 bit length fields. -union FlagsAndLength { - uint8 flags_[4]; // 8 bits - uint32 length_; // 24 bits -}; - -// The basic SPDY Frame structure. -struct SpdyFrameBlock { - union { - struct { - uint16 version_; - uint16 type_; - } control_; - struct { - SpdyStreamId stream_id_; - } data_; - }; - FlagsAndLength flags_length_; -}; - -#pragma pack(pop) - class SpdyFrame; typedef SpdyFrame SpdySerializedFrame; @@ -810,14 +780,6 @@ class SpdyCredentialIR : public SpdyFrameIR { // All Spdy Frame types derive from this SpdyFrame class. class SpdyFrame { public: - // Create a SpdyFrame for a given sized buffer. - explicit SpdyFrame(size_t size) : frame_(NULL), owns_buffer_(true) { - DCHECK_GE(size, sizeof(struct SpdyFrameBlock)); - char* buffer = new char[size]; - memset(buffer, 0, size); - frame_ = reinterpret_cast<struct SpdyFrameBlock*>(buffer); - } - // Create a SpdyFrame using a pre-created buffer. // If |owns_buffer| is true, this class takes ownership of the buffer // and will delete it on cleanup. The buffer must have been created using @@ -826,7 +788,7 @@ class SpdyFrame { // is responsible for making sure the buffer outlives this frame. In other // words, this class does NOT create a copy of the buffer. SpdyFrame(char* data, size_t size, bool owns_buffer) - : frame_(reinterpret_cast<struct SpdyFrameBlock*>(data)), + : frame_(data), size_(size), owns_buffer_(owns_buffer) { DCHECK(frame_); @@ -834,21 +796,20 @@ class SpdyFrame { ~SpdyFrame() { if (owns_buffer_) { - char* buffer = reinterpret_cast<char*>(frame_); - delete [] buffer; + delete [] frame_; } frame_ = NULL; } // Provides access to the frame bytes, which is a buffer containing // the frame packed as expected for sending over the wire. - char* data() const { return reinterpret_cast<char*>(frame_); } + char* data() const { return frame_; } // Returns the actual size of the underlying buffer. size_t size() const { return size_; } protected: - SpdyFrameBlock* frame_; + char* frame_; private: size_t size_; diff --git a/net/spdy/spdy_protocol_test.cc b/net/spdy/spdy_protocol_test.cc index 63ab455..dddd71d 100644 --- a/net/spdy/spdy_protocol_test.cc +++ b/net/spdy/spdy_protocol_test.cc @@ -40,7 +40,6 @@ INSTANTIATE_TEST_CASE_P(SpdyProtocolTests, // Test our protocol constants TEST_P(SpdyProtocolTest, ProtocolConstants) { - EXPECT_EQ(4u, sizeof(FlagsAndLength)); EXPECT_EQ(1, SYN_STREAM); EXPECT_EQ(2, SYN_REPLY); EXPECT_EQ(3, RST_STREAM); |