| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_SPDY_SPDY_FRAME_BUILDER_H_ | 5 #ifndef NET_SPDY_SPDY_FRAME_BUILDER_H_ |
| 6 #define NET_SPDY_SPDY_FRAME_BUILDER_H_ | 6 #define NET_SPDY_SPDY_FRAME_BUILDER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // GetWriteableBuffer() above. | 51 // GetWriteableBuffer() above. |
| 52 bool Seek(size_t length); | 52 bool Seek(size_t length); |
| 53 | 53 |
| 54 // Populates this frame with a HTTP2 frame prefix using length information | 54 // Populates this frame with a HTTP2 frame prefix using length information |
| 55 // from |capacity_|. The given type must be a control frame type. | 55 // from |capacity_|. The given type must be a control frame type. |
| 56 bool BeginNewFrame(const SpdyFramer& framer, | 56 bool BeginNewFrame(const SpdyFramer& framer, |
| 57 SpdyFrameType type, | 57 SpdyFrameType type, |
| 58 uint8_t flags, | 58 uint8_t flags, |
| 59 SpdyStreamId stream_id); | 59 SpdyStreamId stream_id); |
| 60 | 60 |
| 61 // Populates this frame with a HTTP2 frame prefix with length information. |
| 62 // The given type must be a control frame type. |
| 63 bool BeginNewFrame(const SpdyFramer& framer, |
| 64 SpdyFrameType type, |
| 65 uint8_t flags, |
| 66 SpdyStreamId stream_id, |
| 67 size_t length); |
| 68 |
| 61 // Takes the buffer from the SpdyFrameBuilder. | 69 // Takes the buffer from the SpdyFrameBuilder. |
| 62 SpdySerializedFrame take() { | 70 SpdySerializedFrame take() { |
| 63 SPDY_BUG_IF(kMaxFrameSizeLimit < length_) | 71 SPDY_BUG_IF(kMaxFrameSizeLimit < length_) |
| 64 << "Frame length " << length_ | 72 << "Frame length " << length_ |
| 65 << " is longer than the maximum possible allowed length."; | 73 << " is longer than the maximum possible allowed length."; |
| 66 SpdySerializedFrame rv(buffer_.release(), length(), true); | 74 SpdySerializedFrame rv(buffer_.release(), length(), true); |
| 67 capacity_ = 0; | 75 capacity_ = 0; |
| 68 length_ = 0; | 76 length_ = 0; |
| 69 offset_ = 0; | 77 offset_ = 0; |
| 70 return rv; | 78 return rv; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 130 |
| 123 std::unique_ptr<char[]> buffer_; | 131 std::unique_ptr<char[]> buffer_; |
| 124 size_t capacity_; // Allocation size of payload, set by constructor. | 132 size_t capacity_; // Allocation size of payload, set by constructor. |
| 125 size_t length_; // Length of the latest frame in the buffer. | 133 size_t length_; // Length of the latest frame in the buffer. |
| 126 size_t offset_; // Position at which the latest frame begins. | 134 size_t offset_; // Position at which the latest frame begins. |
| 127 }; | 135 }; |
| 128 | 136 |
| 129 } // namespace net | 137 } // namespace net |
| 130 | 138 |
| 131 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_ | 139 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_ |
| OLD | NEW |