| 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 #include "net/quic/core/quic_flags.h" |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 if (GetBlockIndex(gaps_.back().begin_offset - 1) == block_index) { | 464 if (GetBlockIndex(gaps_.back().begin_offset - 1) == block_index) { |
| 465 return; | 465 return; |
| 466 } | 466 } |
| 467 | 467 |
| 468 // Read index remains in this block, which means a gap has been reached. | 468 // Read index remains in this block, which means a gap has been reached. |
| 469 if (NextBlockToRead() == block_index) { | 469 if (NextBlockToRead() == block_index) { |
| 470 Gap first_gap = gaps_.front(); | 470 Gap first_gap = gaps_.front(); |
| 471 DCHECK(first_gap.begin_offset == total_bytes_read_); | 471 DCHECK(first_gap.begin_offset == total_bytes_read_); |
| 472 // Check where the next piece data is. | 472 // Check where the next piece data is. |
| 473 // Not empty if next piece of data is still in this chunk. | 473 // Not empty if next piece of data is still in this chunk. |
| 474 bool gap_extends_to_infinity = | |
| 475 (first_gap.end_offset == std::numeric_limits<QuicStreamOffset>::max()); | |
| 476 bool gap_ends_in_this_block = | 474 bool gap_ends_in_this_block = |
| 477 (GetBlockIndex(first_gap.end_offset) == block_index); | 475 (GetBlockIndex(first_gap.end_offset) == block_index); |
| 478 if ((!FLAGS_quic_sequencer_buffer_retire_block_in_time && | 476 if (gap_ends_in_this_block) { |
| 479 !gap_extends_to_infinity) || | |
| 480 gap_ends_in_this_block) { | |
| 481 return; | 477 return; |
| 482 } | 478 } |
| 483 } | 479 } |
| 484 RetireBlock(block_index); | 480 RetireBlock(block_index); |
| 485 } | 481 } |
| 486 | 482 |
| 487 bool QuicStreamSequencerBuffer::Empty() const { | 483 bool QuicStreamSequencerBuffer::Empty() const { |
| 488 return gaps_.size() == 1 && gaps_.front().begin_offset == total_bytes_read_; | 484 return gaps_.size() == 1 && gaps_.front().begin_offset == total_bytes_read_; |
| 489 } | 485 } |
| 490 | 486 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 QuicStreamOffset current_frame_begin_offset = it.first; | 535 QuicStreamOffset current_frame_begin_offset = it.first; |
| 540 QuicStreamOffset current_frame_end_offset = | 536 QuicStreamOffset current_frame_end_offset = |
| 541 it.second.length + current_frame_begin_offset; | 537 it.second.length + current_frame_begin_offset; |
| 542 current_frames_string += | 538 current_frames_string += |
| 543 RangeDebugString(current_frame_begin_offset, current_frame_end_offset); | 539 RangeDebugString(current_frame_begin_offset, current_frame_end_offset); |
| 544 } | 540 } |
| 545 return current_frames_string; | 541 return current_frames_string; |
| 546 } | 542 } |
| 547 | 543 |
| 548 } // namespace net | 544 } // namespace net |
| OLD | NEW |