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

Unified Diff: net/quic/core/quic_stream_sequencer_buffer.h

Issue 2328633004: lazy allocation and early release memory in QuicStreamSequencerBuffer. Protected by --quic_reduce_s… (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_stream_sequencer_buffer.h
diff --git a/net/quic/core/quic_stream_sequencer_buffer.h b/net/quic/core/quic_stream_sequencer_buffer.h
index e381ec4e32d4a157b3ddc7fc01d7b4ba975f1fc3..135e7d15eaebe142dc1f6916bf14e3ec9bcafcf0 100644
--- a/net/quic/core/quic_stream_sequencer_buffer.h
+++ b/net/quic/core/quic_stream_sequencer_buffer.h
@@ -152,6 +152,9 @@ class NET_EXPORT_PRIVATE QuicStreamSequencerBuffer {
// (To be called only after sequencer's StopReading has been called.)
size_t FlushBufferedFrames();
+ // Free the memory of buffered data.
+ void ReleaseWholeBuffer();
+
// Whether there are bytes can be read out.
bool HasBytesToRead() const;
@@ -161,6 +164,10 @@ class NET_EXPORT_PRIVATE QuicStreamSequencerBuffer {
// Count how many bytes are in buffer at this moment.
size_t BytesBuffered() const;
+ bool reduce_sequencer_buffer_memory_life_time() const {
+ return reduce_sequencer_buffer_memory_life_time_;
+ }
+
private:
friend class test::QuicStreamSequencerBufferPeer;
@@ -228,10 +235,14 @@ class NET_EXPORT_PRIVATE QuicStreamSequencerBuffer {
// Contains Gaps which represents currently missing data.
std::list<Gap> gaps_;
+ // If true, allocate buffer memory upon the first frame arrival and release
+ // the memory when stream is read closed.
+ bool reduce_sequencer_buffer_memory_life_time_;
+
// An ordered, variable-length list of blocks, with the length limited
// such that the number of blocks never exceeds blocks_count_.
// Each list entry can hold up to kBlockSizeBytes bytes.
- std::vector<BufferBlock*> blocks_;
+ std::unique_ptr<BufferBlock* []> blocks_;
// Number of bytes in buffer.
size_t num_bytes_buffered_;
« 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