OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_unacked_packet_map.h" | 5 #include "net/quic/quic_unacked_packet_map.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "net/quic/quic_connection_stats.h" | 9 #include "net/quic/quic_connection_stats.h" |
10 #include "net/quic/quic_utils_chromium.h" | 10 #include "net/quic/quic_utils_chromium.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 unacked_packets_.rbegin(); it != unacked_packets_.rend(); ++it) { | 288 unacked_packets_.rbegin(); it != unacked_packets_.rend(); ++it) { |
289 if (it->in_flight && it->retransmittable_frames) { | 289 if (it->in_flight && it->retransmittable_frames) { |
290 return true; | 290 return true; |
291 } | 291 } |
292 } | 292 } |
293 return false; | 293 return false; |
294 } | 294 } |
295 | 295 |
296 QuicPacketSequenceNumber | 296 QuicPacketSequenceNumber |
297 QuicUnackedPacketMap::GetLeastUnacked() const { | 297 QuicUnackedPacketMap::GetLeastUnacked() const { |
298 if (unacked_packets_.empty()) { | |
299 // If there are no unacked packets, return 0. | |
300 return 0; | |
301 } | |
302 return least_unacked_; | 298 return least_unacked_; |
303 } | 299 } |
304 | 300 |
305 void QuicUnackedPacketMap::SetSent(QuicPacketSequenceNumber sequence_number, | 301 void QuicUnackedPacketMap::SetSent(QuicPacketSequenceNumber sequence_number, |
306 QuicTime sent_time, | 302 QuicTime sent_time, |
307 QuicByteCount bytes_sent, | 303 QuicByteCount bytes_sent, |
308 bool set_in_flight) { | 304 bool set_in_flight) { |
309 DCHECK_GE(sequence_number, least_unacked_); | 305 DCHECK_GE(sequence_number, least_unacked_); |
310 DCHECK_LT(sequence_number, least_unacked_ + unacked_packets_.size()); | 306 DCHECK_LT(sequence_number, least_unacked_ + unacked_packets_.size()); |
311 TransmissionInfo* info = &unacked_packets_[sequence_number - least_unacked_]; | 307 TransmissionInfo* info = &unacked_packets_[sequence_number - least_unacked_]; |
(...skipping 16 matching lines...) Expand all Loading... |
328 TransmissionInfo* info = &unacked_packets_[sequence_number - least_unacked_]; | 324 TransmissionInfo* info = &unacked_packets_[sequence_number - least_unacked_]; |
329 DCHECK(!info->in_flight); | 325 DCHECK(!info->in_flight); |
330 DCHECK_NE(0u, info->bytes_sent); | 326 DCHECK_NE(0u, info->bytes_sent); |
331 DCHECK(info->sent_time.IsInitialized()); | 327 DCHECK(info->sent_time.IsInitialized()); |
332 | 328 |
333 bytes_in_flight_ += info->bytes_sent; | 329 bytes_in_flight_ += info->bytes_sent; |
334 info->in_flight = true; | 330 info->in_flight = true; |
335 } | 331 } |
336 | 332 |
337 } // namespace net | 333 } // namespace net |
OLD | NEW |