Chromium Code Reviews| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 length information. |
| 58 // The given type must be a control frame type. | 58 // The given type must be a control frame type. |
| 59 bool BeginNewFrame(const SpdyFramer& framer, | 59 bool BeginNewFrame(const SpdyFramer& framer, |
| 60 SpdyFrameType type, | 60 SpdyFrameType type, |
| 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 // Populates this frame with a HTTP2 frame prefix with type and length | |
| 66 // information. | |
| 67 bool BeginNewFrame(const SpdyFramer& framer, | |
| 68 uint8_t type, | |
|
xunjieli
2017/04/04 14:36:36
Isn't a SpdyFrameType a uint8_t?
What's the diff b
Bence
2017/04/04 15:19:20
SpdyFrameType is an enum class, and implicit cast
xunjieli
2017/04/04 15:44:41
I see. Function overloads is discouraged per https
Bence
2017/04/04 16:58:47
Sorry, I was not aware of this recommendation from
xunjieli
2017/04/04 17:07:35
Acknowledged. That makes sense.
| |
| 69 uint8_t flags, | |
| 70 SpdyStreamId stream_id, | |
| 71 size_t length); | |
| 72 | |
| 65 // Takes the buffer from the SpdyFrameBuilder. | 73 // Takes the buffer from the SpdyFrameBuilder. |
| 66 SpdySerializedFrame take() { | 74 SpdySerializedFrame take() { |
| 67 SPDY_BUG_IF(output_ != nullptr) << "ZeroCopyOutputBuffer is used to build " | 75 SPDY_BUG_IF(output_ != nullptr) << "ZeroCopyOutputBuffer is used to build " |
| 68 << "frames. take() shouldn't be called"; | 76 << "frames. take() shouldn't be called"; |
| 69 SPDY_BUG_IF(kMaxFrameSizeLimit < length_) | 77 SPDY_BUG_IF(kMaxFrameSizeLimit < length_) |
| 70 << "Frame length " << length_ | 78 << "Frame length " << length_ |
| 71 << " is longer than the maximum possible allowed length."; | 79 << " is longer than the maximum possible allowed length."; |
| 72 SpdySerializedFrame rv(buffer_.release(), length(), true); | 80 SpdySerializedFrame rv(buffer_.release(), length(), true); |
| 73 capacity_ = 0; | 81 capacity_ = 0; |
| 74 length_ = 0; | 82 length_ = 0; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 const size_t kLengthFieldLength = 3; | 152 const size_t kLengthFieldLength = 3; |
| 145 char* start_of_current_frame_ = nullptr; | 153 char* start_of_current_frame_ = nullptr; |
| 146 size_t bytes_of_length_written_in_first_block_ = kLengthFieldLength; | 154 size_t bytes_of_length_written_in_first_block_ = kLengthFieldLength; |
| 147 // In case length of a new frame is cross blocks. | 155 // In case length of a new frame is cross blocks. |
| 148 char* start_of_current_frame_in_next_block_ = nullptr; | 156 char* start_of_current_frame_in_next_block_ = nullptr; |
| 149 }; | 157 }; |
| 150 | 158 |
| 151 } // namespace net | 159 } // namespace net |
| 152 | 160 |
| 153 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_ | 161 #endif // NET_SPDY_SPDY_FRAME_BUILDER_H_ |
| OLD | NEW |