OLD | NEW |
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 #include "net/quic/core/quic_stream_sequencer_buffer.h" | 5 #include "net/quic/core/quic_stream_sequencer_buffer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "net/quic/core/quic_bug_tracker.h" | 9 #include "net/quic/core/quic_bug_tracker.h" |
| 10 #include "net/quic/core/quic_flags.h" |
10 | 11 |
11 using std::min; | 12 using std::min; |
12 using std::string; | 13 using std::string; |
13 | 14 |
14 namespace net { | 15 namespace net { |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 string RangeDebugString(QuicStreamOffset start, QuicStreamOffset end) { | 19 string RangeDebugString(QuicStreamOffset start, QuicStreamOffset end) { |
19 return string("[") + base::Uint64ToString(start) + ", " + | 20 return string("[") + base::Uint64ToString(start) + ", " + |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 return; | 425 return; |
425 } | 426 } |
426 | 427 |
427 // Read index remains in this block, which means a gap has been reached. | 428 // Read index remains in this block, which means a gap has been reached. |
428 if (NextBlockToRead() == block_index) { | 429 if (NextBlockToRead() == block_index) { |
429 Gap first_gap = gaps_.front(); | 430 Gap first_gap = gaps_.front(); |
430 DCHECK(first_gap.begin_offset == total_bytes_read_); | 431 DCHECK(first_gap.begin_offset == total_bytes_read_); |
431 // Check where the next piece data is. | 432 // Check where the next piece data is. |
432 // Not empty if next piece of data is still in this chunk. | 433 // Not empty if next piece of data is still in this chunk. |
433 bool gap_extends_to_infinity = | 434 bool gap_extends_to_infinity = |
434 (first_gap.end_offset != std::numeric_limits<QuicStreamOffset>::max()); | 435 (first_gap.end_offset == std::numeric_limits<QuicStreamOffset>::max()); |
435 bool gap_ends_in_this_block = | 436 bool gap_ends_in_this_block = |
436 (GetBlockIndex(first_gap.end_offset) == block_index); | 437 (GetBlockIndex(first_gap.end_offset) == block_index); |
437 if (gap_extends_to_infinity || gap_ends_in_this_block) { | 438 if ((!FLAGS_quic_sequencer_buffer_retire_block_in_time && |
| 439 !gap_extends_to_infinity) || |
| 440 gap_ends_in_this_block) { |
438 return; | 441 return; |
439 } | 442 } |
440 } | 443 } |
441 RetireBlock(block_index); | 444 RetireBlock(block_index); |
442 } | 445 } |
443 | 446 |
444 bool QuicStreamSequencerBuffer::Empty() const { | 447 bool QuicStreamSequencerBuffer::Empty() const { |
445 return gaps_.size() == 1 && gaps_.front().begin_offset == total_bytes_read_; | 448 return gaps_.size() == 1 && gaps_.front().begin_offset == total_bytes_read_; |
446 } | 449 } |
447 | 450 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 QuicStreamOffset current_frame_begin_offset = it.first; | 499 QuicStreamOffset current_frame_begin_offset = it.first; |
497 QuicStreamOffset current_frame_end_offset = | 500 QuicStreamOffset current_frame_end_offset = |
498 it.second.length + current_frame_begin_offset; | 501 it.second.length + current_frame_begin_offset; |
499 current_frames_string += | 502 current_frames_string += |
500 RangeDebugString(current_frame_begin_offset, current_frame_end_offset); | 503 RangeDebugString(current_frame_begin_offset, current_frame_end_offset); |
501 } | 504 } |
502 return current_frames_string; | 505 return current_frames_string; |
503 } | 506 } |
504 | 507 |
505 } // namespace net | 508 } // namespace net |
OLD | NEW |