| 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" |
| 11 | 11 |
| 12 using std::max; | 12 using std::max; |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 | 15 |
| 16 namespace { | |
| 17 | |
| 18 // Maximum amount of reordering before packets are considered useless for | |
| 19 // RTT measurement purposes. | |
| 20 const QuicPacketCount kMaxReorderingForRtt = 200; | |
| 21 | |
| 22 } // anonymous namespace | |
| 23 | |
| 24 QuicUnackedPacketMap::QuicUnackedPacketMap() | 16 QuicUnackedPacketMap::QuicUnackedPacketMap() |
| 25 : largest_sent_packet_(0), | 17 : largest_sent_packet_(0), |
| 26 largest_observed_(0), | 18 largest_observed_(0), |
| 27 least_unacked_(1), | 19 least_unacked_(1), |
| 28 bytes_in_flight_(0), | 20 bytes_in_flight_(0), |
| 29 pending_crypto_packet_count_(0) { | 21 pending_crypto_packet_count_(0) { |
| 30 } | 22 } |
| 31 | 23 |
| 32 QuicUnackedPacketMap::~QuicUnackedPacketMap() { | 24 QuicUnackedPacketMap::~QuicUnackedPacketMap() { |
| 33 QuicPacketSequenceNumber index = least_unacked_; | 25 QuicPacketSequenceNumber index = least_unacked_; |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 const TransmissionInfo& info) const { | 266 const TransmissionInfo& info) const { |
| 275 return !IsPacketUsefulForMeasuringRtt(sequence_number, info) && | 267 return !IsPacketUsefulForMeasuringRtt(sequence_number, info) && |
| 276 !IsPacketUsefulForCongestionControl(info) && | 268 !IsPacketUsefulForCongestionControl(info) && |
| 277 !IsPacketUsefulForRetransmittableData(info); | 269 !IsPacketUsefulForRetransmittableData(info); |
| 278 } | 270 } |
| 279 | 271 |
| 280 bool QuicUnackedPacketMap::IsPacketRemovable( | 272 bool QuicUnackedPacketMap::IsPacketRemovable( |
| 281 QuicPacketSequenceNumber sequence_number, | 273 QuicPacketSequenceNumber sequence_number, |
| 282 const TransmissionInfo& info) const { | 274 const TransmissionInfo& info) const { |
| 283 return (!IsPacketUsefulForMeasuringRtt(sequence_number, info) || | 275 return (!IsPacketUsefulForMeasuringRtt(sequence_number, info) || |
| 284 unacked_packets_.size() > kMaxReorderingForRtt) && | 276 unacked_packets_.size() > kMaxTrackedPackets / 2) && |
| 285 !IsPacketUsefulForCongestionControl(info) && | 277 !IsPacketUsefulForCongestionControl(info) && |
| 286 !IsPacketUsefulForRetransmittableData(info); | 278 !IsPacketUsefulForRetransmittableData(info); |
| 287 } | 279 } |
| 288 | 280 |
| 289 bool QuicUnackedPacketMap::IsUnacked( | 281 bool QuicUnackedPacketMap::IsUnacked( |
| 290 QuicPacketSequenceNumber sequence_number) const { | 282 QuicPacketSequenceNumber sequence_number) const { |
| 291 if (sequence_number < least_unacked_ || | 283 if (sequence_number < least_unacked_ || |
| 292 sequence_number >= least_unacked_ + unacked_packets_.size()) { | 284 sequence_number >= least_unacked_ + unacked_packets_.size()) { |
| 293 return false; | 285 return false; |
| 294 } | 286 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 } | 377 } |
| 386 } | 378 } |
| 387 return false; | 379 return false; |
| 388 } | 380 } |
| 389 | 381 |
| 390 QuicPacketSequenceNumber QuicUnackedPacketMap::GetLeastUnacked() const { | 382 QuicPacketSequenceNumber QuicUnackedPacketMap::GetLeastUnacked() const { |
| 391 return least_unacked_; | 383 return least_unacked_; |
| 392 } | 384 } |
| 393 | 385 |
| 394 } // namespace net | 386 } // namespace net |
| OLD | NEW |