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/quic_stream_sequencer.h" | 5 #include "net/quic/quic_stream_sequencer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "net/quic/quic_bug_tracker.h" |
12 #include "net/quic/quic_clock.h" | 13 #include "net/quic/quic_clock.h" |
13 #include "net/quic/quic_flags.h" | 14 #include "net/quic/quic_flags.h" |
14 #include "net/quic/quic_frame_list.h" | 15 #include "net/quic/quic_frame_list.h" |
15 #include "net/quic/quic_protocol.h" | 16 #include "net/quic/quic_protocol.h" |
16 #include "net/quic/reliable_quic_stream.h" | 17 #include "net/quic/reliable_quic_stream.h" |
17 #include "net/quic/stream_sequencer_buffer.h" | 18 #include "net/quic/stream_sequencer_buffer.h" |
18 | 19 |
19 using std::min; | 20 using std::min; |
20 using std::numeric_limits; | 21 using std::numeric_limits; |
21 using std::string; | 22 using std::string; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 152 } |
152 | 153 |
153 bool QuicStreamSequencer::IsClosed() const { | 154 bool QuicStreamSequencer::IsClosed() const { |
154 return buffered_frames_->BytesConsumed() >= close_offset_; | 155 return buffered_frames_->BytesConsumed() >= close_offset_; |
155 } | 156 } |
156 | 157 |
157 void QuicStreamSequencer::MarkConsumed(size_t num_bytes_consumed) { | 158 void QuicStreamSequencer::MarkConsumed(size_t num_bytes_consumed) { |
158 DCHECK(!blocked_); | 159 DCHECK(!blocked_); |
159 bool result = buffered_frames_->MarkConsumed(num_bytes_consumed); | 160 bool result = buffered_frames_->MarkConsumed(num_bytes_consumed); |
160 if (!result) { | 161 if (!result) { |
161 LOG(DFATAL) << "Invalid argument to MarkConsumed." | 162 QUIC_BUG << "Invalid argument to MarkConsumed." |
162 << " expect to consume: " << num_bytes_consumed | 163 << " expect to consume: " << num_bytes_consumed |
163 << ", but not enough bytes available."; | 164 << ", but not enough bytes available."; |
164 stream_->Reset(QUIC_ERROR_PROCESSING_STREAM); | 165 stream_->Reset(QUIC_ERROR_PROCESSING_STREAM); |
165 return; | 166 return; |
166 } | 167 } |
167 stream_->AddBytesConsumed(num_bytes_consumed); | 168 stream_->AddBytesConsumed(num_bytes_consumed); |
168 } | 169 } |
169 | 170 |
170 void QuicStreamSequencer::SetBlockedUntilFlush() { | 171 void QuicStreamSequencer::SetBlockedUntilFlush() { |
171 blocked_ = true; | 172 blocked_ = true; |
172 } | 173 } |
173 | 174 |
(...skipping 24 matching lines...) Expand all Loading... |
198 | 199 |
199 size_t QuicStreamSequencer::NumBytesBuffered() const { | 200 size_t QuicStreamSequencer::NumBytesBuffered() const { |
200 return buffered_frames_->BytesBuffered(); | 201 return buffered_frames_->BytesBuffered(); |
201 } | 202 } |
202 | 203 |
203 QuicStreamOffset QuicStreamSequencer::NumBytesConsumed() const { | 204 QuicStreamOffset QuicStreamSequencer::NumBytesConsumed() const { |
204 return buffered_frames_->BytesConsumed(); | 205 return buffered_frames_->BytesConsumed(); |
205 } | 206 } |
206 | 207 |
207 } // namespace net | 208 } // namespace net |
OLD | NEW |