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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 // GetWriteableBuffer() above. | 47 // GetWriteableBuffer() above. |
48 bool Seek(size_t length); | 48 bool Seek(size_t length); |
49 | 49 |
50 // Populates this frame with a HTTP2 frame prefix using length information | 50 // Populates this frame with a HTTP2 frame prefix using length information |
51 // from |capacity_|. The given type must be a control frame type. | 51 // from |capacity_|. The given type must be a control frame type. |
52 bool BeginNewFrame(const SpdyFramer& framer, | 52 bool BeginNewFrame(const SpdyFramer& framer, |
53 SpdyFrameType type, | 53 SpdyFrameType type, |
54 uint8_t flags, | 54 uint8_t flags, |
55 SpdyStreamId stream_id); | 55 SpdyStreamId stream_id); |
56 | 56 |
57 // Populates this frame with a HTTP2 frame prefix with length information. | 57 // Populates this frame with a HTTP2 frame prefix with type and length |
58 // The given type must be a control frame type. | 58 // information. |
59 bool BeginNewFrame(const SpdyFramer& framer, | 59 bool BeginNewFrame(const SpdyFramer& framer, |
60 SpdyFrameType type, | 60 uint8_t type, |
xunjieli
2017/04/04 17:07:36
minor nit: could you s/type/raw_frame_type to matc
Bence
2017/04/04 18:46:38
Done.
| |
61 uint8_t flags, | 61 uint8_t flags, |
62 SpdyStreamId stream_id, | 62 SpdyStreamId stream_id, |
63 size_t length); | 63 size_t length); |
64 | 64 |
65 // Takes the buffer from the SpdyFrameBuilder. | 65 // Takes the buffer from the SpdyFrameBuilder. |
66 SpdySerializedFrame take() { | 66 SpdySerializedFrame take() { |
67 SPDY_BUG_IF(output_ != nullptr) << "ZeroCopyOutputBuffer is used to build " | 67 SPDY_BUG_IF(output_ != nullptr) << "ZeroCopyOutputBuffer is used to build " |
68 << "frames. take() shouldn't be called"; | 68 << "frames. take() shouldn't be called"; |
69 SPDY_BUG_IF(kMaxFrameSizeLimit < length_) | 69 SPDY_BUG_IF(kMaxFrameSizeLimit < length_) |
70 << "Frame length " << length_ | 70 << "Frame length " << length_ |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 const size_t kLengthFieldLength = 3; | 144 const size_t kLengthFieldLength = 3; |
145 char* start_of_current_frame_ = nullptr; | 145 char* start_of_current_frame_ = nullptr; |
146 size_t bytes_of_length_written_in_first_block_ = kLengthFieldLength; | 146 size_t bytes_of_length_written_in_first_block_ = kLengthFieldLength; |
147 // In case length of a new frame is cross blocks. | 147 // In case length of a new frame is cross blocks. |
148 char* start_of_current_frame_in_next_block_ = nullptr; | 148 char* start_of_current_frame_in_next_block_ = nullptr; |
149 }; | 149 }; |
150 | 150 |
151 } // namespace net | 151 } // namespace net |
152 | 152 |
153 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_ | 153 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_ |
OLD | NEW |