Overhaul of how SPDY frame headers are written, useful for SPDY 4 development.
Also gets rid of SpdyFrame::kHeaderSize.
This lands server change 42903918.
Review URL: https://codereview.chromium.org/12313087
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184773 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/spdy/spdy_frame_builder.h b/net/spdy/spdy_frame_builder.h
index b45acae90..1764beb 100644
--- a/net/spdy/spdy_frame_builder.h
+++ b/net/spdy/spdy_frame_builder.h
@@ -30,19 +30,6 @@
// Initializes a SpdyFrameBuilder with a buffer of given size
explicit SpdyFrameBuilder(size_t size);
- // Initializes a SpdyFrameBuilder with a buffer of given size,
- // populate with a SPDY control frame header based on
- // |type|, |flags|, and |spdy_version|.
- //
- // TODO(akalin): Add a typedef for this uint8.
- SpdyFrameBuilder(SpdyControlType type, uint8 flags,
- int spdy_version, size_t size);
-
- // Initiailizes a SpdyFrameBuilder with a buffer of given size,
- // populated with a SPDY data frame header based on
- // |stream_id| and |flags|.
- SpdyFrameBuilder(SpdyStreamId stream_id, SpdyDataFlags flags, size_t size);
-
~SpdyFrameBuilder();
// Returns the size of the SpdyFrameBuilder's data.
@@ -60,6 +47,19 @@
// GetWriteableBuffer() above.
bool Seek(size_t length);
+ // Populates this frame with a SPDY control frame header using
+ // version-specific information from the |framer| and length information from
+ // capacity_.
+ bool WriteControlFrameHeader(const SpdyFramer& framer,
+ SpdyControlType type,
+ uint8 flags);
+
+ // Populates this frame with a SPDY data frame header using version-specific
+ // information from the |framer| and length information from capacity_.
+ bool WriteDataFrameHeader(const SpdyFramer& framer,
+ SpdyStreamId stream_id,
+ SpdyDataFlags flags);
+
// Takes the buffer from the SpdyFrameBuilder.
SpdyFrame* take() {
SpdyFrame* rv = new SpdyFrame(buffer_.release(), length_, true);
@@ -110,8 +110,8 @@
bool CanWrite(size_t length) const;
scoped_ptr<char[]> buffer_;
- size_t capacity_; // Allocation size of payload (or -1 if buffer is const).
- size_t length_; // current length of the buffer
+ size_t capacity_; // Allocation size of payload, set by constructor.
+ size_t length_; // Current length of the buffer.
};
} // namespace net