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

Side by Side Diff: net/quic/core/quic_stream_sequencer.cc

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 unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_stream_sequencer.h ('k') | net/quic/core/quic_stream_sequencer_buffer.h » ('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 #include "net/quic/core/quic_stream_sequencer.h" 5 #include "net/quic/core/quic_stream_sequencer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 179
180 void QuicStreamSequencer::StopReading() { 180 void QuicStreamSequencer::StopReading() {
181 if (ignore_read_data_) { 181 if (ignore_read_data_) {
182 return; 182 return;
183 } 183 }
184 ignore_read_data_ = true; 184 ignore_read_data_ = true;
185 FlushBufferedFrames(); 185 FlushBufferedFrames();
186 } 186 }
187 187
188 void QuicStreamSequencer::ReleaseBuffer() {
189 buffered_frames_.ReleaseWholeBuffer();
190 }
191
188 void QuicStreamSequencer::FlushBufferedFrames() { 192 void QuicStreamSequencer::FlushBufferedFrames() {
189 DCHECK(ignore_read_data_); 193 DCHECK(ignore_read_data_);
190 size_t bytes_flushed = buffered_frames_.FlushBufferedFrames(); 194 size_t bytes_flushed = buffered_frames_.FlushBufferedFrames();
191 DVLOG(1) << "Flushing buffered data at offset " 195 DVLOG(1) << "Flushing buffered data at offset "
192 << buffered_frames_.BytesConsumed() << " length " << bytes_flushed 196 << buffered_frames_.BytesConsumed() << " length " << bytes_flushed
193 << " for stream " << stream_->id(); 197 << " for stream " << stream_->id();
194 stream_->AddBytesConsumed(bytes_flushed); 198 stream_->AddBytesConsumed(bytes_flushed);
195 MaybeCloseStream(); 199 MaybeCloseStream();
196 } 200 }
197 201
(...skipping 11 matching lines...) Expand all
209 "\n bytes buffered: " + IntToString(NumBytesBuffered()) + 213 "\n bytes buffered: " + IntToString(NumBytesBuffered()) +
210 "\n bytes consumed: " + IntToString( NumBytesConsumed()) + 214 "\n bytes consumed: " + IntToString( NumBytesConsumed()) +
211 "\n has bytes to read: " + (HasBytesToRead() ? "true" : "false") + 215 "\n has bytes to read: " + (HasBytesToRead() ? "true" : "false") +
212 "\n frames received: " + IntToString(num_frames_received()) + 216 "\n frames received: " + IntToString(num_frames_received()) +
213 "\n close offset bytes: " + IntToString( close_offset_) + 217 "\n close offset bytes: " + IntToString( close_offset_) +
214 "\n is closed: " + (IsClosed() ? "true" : "false"); 218 "\n is closed: " + (IsClosed() ? "true" : "false");
215 // clang-format on 219 // clang-format on
216 } 220 }
217 221
218 } // namespace net 222 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_stream_sequencer.h ('k') | net/quic/core/quic_stream_sequencer_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698