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

Side by Side Diff: net/quic/core/quic_stream_sequencer_buffer.h

Issue 2487613002: Landing Recent QUIC changes until 12:43 PM, Nov 5, 2016 UTC+8 (Closed)
Patch Set: Created 4 years, 1 month 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/quic/core/quic_stream_sequencer.cc ('k') | net/quic/core/quic_stream_sequencer_buffer.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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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_QUIC_QUIC_STREAM_SEQUENCER_BUFFER_H_ 5 #ifndef NET_QUIC_QUIC_STREAM_SEQUENCER_BUFFER_H_
6 #define NET_QUIC_QUIC_STREAM_SEQUENCER_BUFFER_H_ 6 #define NET_QUIC_QUIC_STREAM_SEQUENCER_BUFFER_H_
7 7
8 // QuicStreamSequencerBuffer implements QuicStreamSequencerBufferInterface. 8 // QuicStreamSequencerBuffer implements QuicStreamSequencerBufferInterface.
9 // It is a circular stream buffer with random write and 9 // It is a circular stream buffer with random write and
10 // in-sequence read. It consists of a vector of pointers pointing 10 // in-sequence read. It consists of a vector of pointers pointing
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 // Whether there are bytes can be read out. 162 // Whether there are bytes can be read out.
163 bool HasBytesToRead() const; 163 bool HasBytesToRead() const;
164 164
165 // Count how many bytes have been consumed (read out of buffer). 165 // Count how many bytes have been consumed (read out of buffer).
166 QuicStreamOffset BytesConsumed() const; 166 QuicStreamOffset BytesConsumed() const;
167 167
168 // Count how many bytes are in buffer at this moment. 168 // Count how many bytes are in buffer at this moment.
169 size_t BytesBuffered() const; 169 size_t BytesBuffered() const;
170 170
171 bool reduce_sequencer_buffer_memory_life_time() const {
172 return reduce_sequencer_buffer_memory_life_time_;
173 }
174
175 private: 171 private:
176 friend class test::QuicStreamSequencerBufferPeer; 172 friend class test::QuicStreamSequencerBufferPeer;
177 173
178 // Dispose the given buffer block. 174 // Dispose the given buffer block.
179 // After calling this method, blocks_[index] is set to nullptr 175 // After calling this method, blocks_[index] is set to nullptr
180 // in order to indicate that no memory set is allocated for that block. 176 // in order to indicate that no memory set is allocated for that block.
181 // Returns true on success, false otherwise. 177 // Returns true on success, false otherwise.
182 bool RetireBlock(size_t index); 178 bool RetireBlock(size_t index);
183 179
184 // Should only be called after the indexed block is read till the end of the 180 // Should only be called after the indexed block is read till the end of the
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 230
235 // How many blocks this buffer would need when it reaches full capacity. 231 // How many blocks this buffer would need when it reaches full capacity.
236 const size_t blocks_count_; 232 const size_t blocks_count_;
237 233
238 // Number of bytes read out of buffer. 234 // Number of bytes read out of buffer.
239 QuicStreamOffset total_bytes_read_; 235 QuicStreamOffset total_bytes_read_;
240 236
241 // Contains Gaps which represents currently missing data. 237 // Contains Gaps which represents currently missing data.
242 std::list<Gap> gaps_; 238 std::list<Gap> gaps_;
243 239
244 // If true, allocate buffer memory upon the first frame arrival and release
245 // the memory when stream is read closed.
246 bool reduce_sequencer_buffer_memory_life_time_;
247
248 // An ordered, variable-length list of blocks, with the length limited 240 // An ordered, variable-length list of blocks, with the length limited
249 // such that the number of blocks never exceeds blocks_count_. 241 // such that the number of blocks never exceeds blocks_count_.
250 // Each list entry can hold up to kBlockSizeBytes bytes. 242 // Each list entry can hold up to kBlockSizeBytes bytes.
251 std::unique_ptr<BufferBlock* []> blocks_; 243 std::unique_ptr<BufferBlock* []> blocks_;
252 244
253 // Number of bytes in buffer. 245 // Number of bytes in buffer.
254 size_t num_bytes_buffered_; 246 size_t num_bytes_buffered_;
255 247
256 // Stores all the buffered frames' start offset, length and arrival time. 248 // Stores all the buffered frames' start offset, length and arrival time.
257 std::map<QuicStreamOffset, FrameInfo> frame_arrival_time_map_; 249 std::map<QuicStreamOffset, FrameInfo> frame_arrival_time_map_;
258 250
259 DISALLOW_COPY_AND_ASSIGN(QuicStreamSequencerBuffer); 251 DISALLOW_COPY_AND_ASSIGN(QuicStreamSequencerBuffer);
260 }; 252 };
261 } // namespace net 253 } // namespace net
262 254
263 #endif // NET_QUIC_QUIC_STREAM_SEQUENCER_BUFFER_H_ 255 #endif // NET_QUIC_QUIC_STREAM_SEQUENCER_BUFFER_H_
OLDNEW
« no previous file with comments | « net/quic/core/quic_stream_sequencer.cc ('k') | net/quic/core/quic_stream_sequencer_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698