| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // capacity_. The given type must be a control frame type. | 70 // capacity_. The given type must be a control frame type. |
| 71 // Used only for SPDY versions >=4. | 71 // Used only for SPDY versions >=4. |
| 72 bool BeginNewFrame(const SpdyFramer& framer, | 72 bool BeginNewFrame(const SpdyFramer& framer, |
| 73 SpdyFrameType type, | 73 SpdyFrameType type, |
| 74 uint8_t flags, | 74 uint8_t flags, |
| 75 SpdyStreamId stream_id); | 75 SpdyStreamId stream_id); |
| 76 | 76 |
| 77 // Takes the buffer from the SpdyFrameBuilder. | 77 // Takes the buffer from the SpdyFrameBuilder. |
| 78 SpdySerializedFrame take() { | 78 SpdySerializedFrame take() { |
| 79 if (version_ == HTTP2) { | 79 if (version_ == HTTP2) { |
| 80 SPDY_BUG_IF(SpdyConstants::GetFrameMaximumSize(version_) < length_) | 80 SPDY_BUG_IF(SpdyConstants::GetMaxFrameSizeLimit(version_) < length_) |
| 81 << "Frame length " << length_ | 81 << "Frame length " << length_ |
| 82 << " is longer than the maximum allowed length."; | 82 << " is longer than the maximum possible allowed length."; |
| 83 } | 83 } |
| 84 SpdySerializedFrame rv(buffer_.release(), length(), true); | 84 SpdySerializedFrame rv(buffer_.release(), length(), true); |
| 85 capacity_ = 0; | 85 capacity_ = 0; |
| 86 length_ = 0; | 86 length_ = 0; |
| 87 offset_ = 0; | 87 offset_ = 0; |
| 88 return rv; | 88 return rv; |
| 89 } | 89 } |
| 90 | 90 |
| 91 // Methods for adding to the payload. These values are appended to the end | 91 // Methods for adding to the payload. These values are appended to the end |
| 92 // of the SpdyFrameBuilder payload. Note - binary integers are converted from | 92 // of the SpdyFrameBuilder payload. Note - binary integers are converted from |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 size_t capacity_; // Allocation size of payload, set by constructor. | 143 size_t capacity_; // Allocation size of payload, set by constructor. |
| 144 size_t length_; // Length of the latest frame in the buffer. | 144 size_t length_; // Length of the latest frame in the buffer. |
| 145 size_t offset_; // Position at which the latest frame begins. | 145 size_t offset_; // Position at which the latest frame begins. |
| 146 | 146 |
| 147 const SpdyMajorVersion version_; | 147 const SpdyMajorVersion version_; |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 } // namespace net | 150 } // namespace net |
| 151 | 151 |
| 152 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_ | 152 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_ |
| OLD | NEW |