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

Unified Diff: net/spdy/spdy_frame_builder.h

Issue 246013002: SPDY: Headers & Push-Promise now use Continuations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase only Created 6 years, 8 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 | « net/quic/spdy_utils.cc ('k') | net/spdy/spdy_frame_builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_frame_builder.h
diff --git a/net/spdy/spdy_frame_builder.h b/net/spdy/spdy_frame_builder.h
index f9826d0ae5301ecea8292534b734be21d41227d0..b4089baf6181b796d20815fb8393ba5f2a07c4c2 100644
--- a/net/spdy/spdy_frame_builder.h
+++ b/net/spdy/spdy_frame_builder.h
@@ -28,12 +28,13 @@ class SpdyFramer;
class NET_EXPORT_PRIVATE SpdyFrameBuilder {
public:
// Initializes a SpdyFrameBuilder with a buffer of given size
- explicit SpdyFrameBuilder(size_t size);
+ SpdyFrameBuilder(size_t size, SpdyMajorVersion version);
~SpdyFrameBuilder();
- // Returns the size of the SpdyFrameBuilder's data.
- size_t length() const { return length_; }
+ // Returns the total size of the SpdyFrameBuilder's data, which may include
+ // multiple frames.
+ size_t length() const { return offset_ + length_; }
// Returns a writeable buffer of given size in bytes, to be appended to the
// currently written frame. Does bounds checking on length but does not
@@ -65,16 +66,22 @@ class NET_EXPORT_PRIVATE SpdyFrameBuilder {
// version-specific information from the |framer| and length information from
// capacity_. The given type must be a control frame type.
// Used only for SPDY versions >=4.
- bool WriteFramePrefix(const SpdyFramer& framer,
- SpdyFrameType type,
- uint8 flags,
- SpdyStreamId stream_id);
+ bool BeginNewFrame(const SpdyFramer& framer,
+ SpdyFrameType type,
+ uint8 flags,
+ SpdyStreamId stream_id);
// Takes the buffer from the SpdyFrameBuilder.
SpdyFrame* take() {
- SpdyFrame* rv = new SpdyFrame(buffer_.release(), length_, true);
+ if (version_ > SPDY3) {
+ DLOG_IF(DFATAL, SpdyConstants::GetFrameMaximumSize(version_) < length_)
+ << "Frame length " << length_
+ << " is longer than the maximum allowed length.";
+ }
+ SpdyFrame* rv = new SpdyFrame(buffer_.release(), length(), true);
capacity_ = 0;
length_ = 0;
+ offset_ = 0;
return rv;
}
@@ -129,7 +136,10 @@ class NET_EXPORT_PRIVATE SpdyFrameBuilder {
scoped_ptr<char[]> buffer_;
size_t capacity_; // Allocation size of payload, set by constructor.
- size_t length_; // Current length of the buffer.
+ size_t length_; // Length of the latest frame in the buffer.
+ size_t offset_; // Position at which the latest frame begins.
+
+ const SpdyMajorVersion version_;
};
} // namespace net
« no previous file with comments | « net/quic/spdy_utils.cc ('k') | net/spdy/spdy_frame_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698