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/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 if (blocks_[i] != nullptr) { | 68 if (blocks_[i] != nullptr) { |
69 RetireBlock(i); | 69 RetireBlock(i); |
70 } | 70 } |
71 } | 71 } |
72 } | 72 } |
73 num_bytes_buffered_ = 0; | 73 num_bytes_buffered_ = 0; |
74 // Reset gaps_ so that buffer is in a state as if all data before | 74 // Reset gaps_ so that buffer is in a state as if all data before |
75 // total_bytes_read_ has been consumed, and those after total_bytes_read_ | 75 // total_bytes_read_ has been consumed, and those after total_bytes_read_ |
76 // has never arrived. | 76 // has never arrived. |
77 gaps_ = std::list<Gap>( | 77 gaps_ = std::list<Gap>( |
78 1, Gap(total_bytes_read_, std::numeric_limits<QuicStreamOffset>::max())), | 78 1, Gap(total_bytes_read_, std::numeric_limits<QuicStreamOffset>::max())); |
79 frame_arrival_time_map_.clear(); | 79 frame_arrival_time_map_.clear(); |
80 } | 80 } |
81 | 81 |
82 bool QuicStreamSequencerBuffer::RetireBlock(size_t idx) { | 82 bool QuicStreamSequencerBuffer::RetireBlock(size_t idx) { |
83 if (blocks_[idx] == nullptr) { | 83 if (blocks_[idx] == nullptr) { |
84 QUIC_BUG << "Try to retire block twice"; | 84 QUIC_BUG << "Try to retire block twice"; |
85 return false; | 85 return false; |
86 } | 86 } |
87 delete blocks_[idx]; | 87 delete blocks_[idx]; |
88 blocks_[idx] = nullptr; | 88 blocks_[idx] = nullptr; |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 QuicStreamOffset current_frame_end_offset = | 590 QuicStreamOffset current_frame_end_offset = |
591 it.second.length + current_frame_begin_offset; | 591 it.second.length + current_frame_begin_offset; |
592 current_frames_string = string(StringPrintf( | 592 current_frames_string = string(StringPrintf( |
593 "%s[%" PRIu64 ", %" PRIu64 ") ", current_frames_string.c_str(), | 593 "%s[%" PRIu64 ", %" PRIu64 ") ", current_frames_string.c_str(), |
594 current_frame_begin_offset, current_frame_end_offset)); | 594 current_frame_begin_offset, current_frame_end_offset)); |
595 } | 595 } |
596 return current_frames_string; | 596 return current_frames_string; |
597 } | 597 } |
598 | 598 |
599 } // namespace net | 599 } // namespace net |
OLD | NEW |