| 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 #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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 return; | 190 return; |
| 191 } | 191 } |
| 192 ignore_read_data_ = true; | 192 ignore_read_data_ = true; |
| 193 FlushBufferedFrames(); | 193 FlushBufferedFrames(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void QuicStreamSequencer::ReleaseBuffer() { | 196 void QuicStreamSequencer::ReleaseBuffer() { |
| 197 buffered_frames_.ReleaseWholeBuffer(); | 197 buffered_frames_.ReleaseWholeBuffer(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 void QuicStreamSequencer::ReleaseBufferIfEmpty() { |
| 201 if (FLAGS_quic_release_crypto_stream_buffer && buffered_frames_.Empty()) { |
| 202 buffered_frames_.ReleaseWholeBuffer(); |
| 203 } |
| 204 } |
| 205 |
| 200 void QuicStreamSequencer::FlushBufferedFrames() { | 206 void QuicStreamSequencer::FlushBufferedFrames() { |
| 201 DCHECK(ignore_read_data_); | 207 DCHECK(ignore_read_data_); |
| 202 size_t bytes_flushed = buffered_frames_.FlushBufferedFrames(); | 208 size_t bytes_flushed = buffered_frames_.FlushBufferedFrames(); |
| 203 DVLOG(1) << "Flushing buffered data at offset " | 209 DVLOG(1) << "Flushing buffered data at offset " |
| 204 << buffered_frames_.BytesConsumed() << " length " << bytes_flushed | 210 << buffered_frames_.BytesConsumed() << " length " << bytes_flushed |
| 205 << " for stream " << stream_->id(); | 211 << " for stream " << stream_->id(); |
| 206 stream_->AddBytesConsumed(bytes_flushed); | 212 stream_->AddBytesConsumed(bytes_flushed); |
| 207 MaybeCloseStream(); | 213 MaybeCloseStream(); |
| 208 } | 214 } |
| 209 | 215 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 221 "\n bytes buffered: " + IntToString(NumBytesBuffered()) + | 227 "\n bytes buffered: " + IntToString(NumBytesBuffered()) + |
| 222 "\n bytes consumed: " + IntToString( NumBytesConsumed()) + | 228 "\n bytes consumed: " + IntToString( NumBytesConsumed()) + |
| 223 "\n has bytes to read: " + (HasBytesToRead() ? "true" : "false") + | 229 "\n has bytes to read: " + (HasBytesToRead() ? "true" : "false") + |
| 224 "\n frames received: " + IntToString(num_frames_received()) + | 230 "\n frames received: " + IntToString(num_frames_received()) + |
| 225 "\n close offset bytes: " + IntToString( close_offset_) + | 231 "\n close offset bytes: " + IntToString( close_offset_) + |
| 226 "\n is closed: " + (IsClosed() ? "true" : "false"); | 232 "\n is closed: " + (IsClosed() ? "true" : "false"); |
| 227 // clang-format on | 233 // clang-format on |
| 228 } | 234 } |
| 229 | 235 |
| 230 } // namespace net | 236 } // namespace net |
| OLD | NEW |