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

Side by Side Diff: net/spdy/core/spdy_frame_builder.h

Issue 2861893002: Deprecate remove_rewritelength flag. (Closed)
Patch Set: missed a SPDY_BUG Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « net/spdy/chromium/spdy_flags.cc ('k') | net/spdy/core/spdy_frame_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CORE_SPDY_FRAME_BUILDER_H_ 5 #ifndef NET_SPDY_CORE_SPDY_FRAME_BUILDER_H_
6 #define NET_SPDY_CORE_SPDY_FRAME_BUILDER_H_ 6 #define NET_SPDY_CORE_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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 bool WriteUInt64(uint64_t value) { 103 bool WriteUInt64(uint64_t value) {
104 uint32_t upper = base::HostToNet32(static_cast<uint32_t>(value >> 32)); 104 uint32_t upper = base::HostToNet32(static_cast<uint32_t>(value >> 32));
105 uint32_t lower = base::HostToNet32(static_cast<uint32_t>(value)); 105 uint32_t lower = base::HostToNet32(static_cast<uint32_t>(value));
106 return (WriteBytes(&upper, sizeof(upper)) && 106 return (WriteBytes(&upper, sizeof(upper)) &&
107 WriteBytes(&lower, sizeof(lower))); 107 WriteBytes(&lower, sizeof(lower)));
108 } 108 }
109 bool WriteStringPiece16(const SpdyStringPiece& value); 109 bool WriteStringPiece16(const SpdyStringPiece& value);
110 bool WriteStringPiece32(const SpdyStringPiece& value); 110 bool WriteStringPiece32(const SpdyStringPiece& value);
111 bool WriteBytes(const void* data, uint32_t data_len); 111 bool WriteBytes(const void* data, uint32_t data_len);
112 112
113 // Update (in-place) the length field in the frame being built to reflect the
114 // given length.
115 // The framer parameter is used to determine version-specific location and
116 // size information of the length field to be written, and must be initialized
117 // with the correct version for the frame being written.
118 bool OverwriteLength(const SpdyFramer& framer, size_t length);
119
120 private: 113 private:
121 FRIEND_TEST_ALL_PREFIXES(SpdyFrameBuilderTest, GetWritableBuffer); 114 FRIEND_TEST_ALL_PREFIXES(SpdyFrameBuilderTest, GetWritableBuffer);
122 FRIEND_TEST_ALL_PREFIXES(SpdyFrameBuilderTest, GetWritableOutput); 115 FRIEND_TEST_ALL_PREFIXES(SpdyFrameBuilderTest, GetWritableOutput);
123 FRIEND_TEST_ALL_PREFIXES(SpdyFrameBuilderTest, GetWritableOutputNegative); 116 FRIEND_TEST_ALL_PREFIXES(SpdyFrameBuilderTest, GetWritableOutputNegative);
124 117
125 // Populates this frame with a HTTP2 frame prefix with type and length 118 // Populates this frame with a HTTP2 frame prefix with type and length
126 // information. 119 // information.
127 bool BeginNewFrameInternal(const SpdyFramer& framer, 120 bool BeginNewFrameInternal(const SpdyFramer& framer,
128 uint8_t raw_frame_type, 121 uint8_t raw_frame_type,
129 uint8_t flags, 122 uint8_t flags,
(...skipping 16 matching lines...) Expand all
146 // A buffer to be created whenever a new frame needs to be written. Used only 139 // A buffer to be created whenever a new frame needs to be written. Used only
147 // if |output_| is nullptr. 140 // if |output_| is nullptr.
148 std::unique_ptr<char[]> buffer_; 141 std::unique_ptr<char[]> buffer_;
149 // A pre-allocated buffer. If not-null, serialized frame data is written to 142 // A pre-allocated buffer. If not-null, serialized frame data is written to
150 // this buffer. 143 // this buffer.
151 ZeroCopyOutputBuffer* output_ = nullptr; // Does not own. 144 ZeroCopyOutputBuffer* output_ = nullptr; // Does not own.
152 145
153 size_t capacity_; // Allocation size of payload, set by constructor. 146 size_t capacity_; // Allocation size of payload, set by constructor.
154 size_t length_; // Length of the latest frame in the buffer. 147 size_t length_; // Length of the latest frame in the buffer.
155 size_t offset_; // Position at which the latest frame begins. 148 size_t offset_; // Position at which the latest frame begins.
156
157 // Remove all four below after
158 // FLAGS_chromium_http2_flag_remove_rewritelength deprecates.
159 const size_t kLengthFieldLength = 3;
160 char* start_of_current_frame_ = nullptr;
161 size_t bytes_of_length_written_in_first_block_ = kLengthFieldLength;
162 // In case length of a new frame is cross blocks.
163 char* start_of_current_frame_in_next_block_ = nullptr;
164 }; 149 };
165 150
166 } // namespace net 151 } // namespace net
167 152
168 #endif // NET_SPDY_CORE_SPDY_FRAME_BUILDER_H_ 153 #endif // NET_SPDY_CORE_SPDY_FRAME_BUILDER_H_
OLDNEW
« no previous file with comments | « net/spdy/chromium/spdy_flags.cc ('k') | net/spdy/core/spdy_frame_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698