| 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 "net/quic/quic_bug_tracker.h" |
| 9 #include "net/quic/quic_connection_stats.h" | 9 #include "net/quic/quic_connection_stats.h" |
| 10 #include "net/quic/quic_flags.h" | 10 #include "net/quic/quic_flags.h" |
| 11 #include "net/quic/quic_utils_chromium.h" | 11 #include "net/quic/quic_utils_chromium.h" |
| 12 | 12 |
| 13 using std::max; | 13 using std::max; |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 QuicUnackedPacketMap::QuicUnackedPacketMap() | 17 QuicUnackedPacketMap::QuicUnackedPacketMap() |
| 18 : largest_sent_packet_(0), | 18 : largest_sent_packet_(0), |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 void QuicUnackedPacketMap::TransferRetransmissionInfo( | 89 void QuicUnackedPacketMap::TransferRetransmissionInfo( |
| 90 QuicPacketNumber old_packet_number, | 90 QuicPacketNumber old_packet_number, |
| 91 QuicPacketNumber new_packet_number, | 91 QuicPacketNumber new_packet_number, |
| 92 TransmissionType transmission_type, | 92 TransmissionType transmission_type, |
| 93 TransmissionInfo* info) { | 93 TransmissionInfo* info) { |
| 94 if (old_packet_number < least_unacked_ || | 94 if (old_packet_number < least_unacked_ || |
| 95 old_packet_number > largest_sent_packet_) { | 95 old_packet_number > largest_sent_packet_) { |
| 96 LOG(DFATAL) << "Old TransmissionInfo no longer exists for:" | 96 QUIC_BUG << "Old TransmissionInfo no longer exists for:" |
| 97 << old_packet_number << " least_unacked:" << least_unacked_ | 97 << old_packet_number << " least_unacked:" << least_unacked_ |
| 98 << " largest_sent:" << largest_sent_packet_; | 98 << " largest_sent:" << largest_sent_packet_; |
| 99 return; | 99 return; |
| 100 } | 100 } |
| 101 DCHECK_GE(new_packet_number, least_unacked_ + unacked_packets_.size()); | 101 DCHECK_GE(new_packet_number, least_unacked_ + unacked_packets_.size()); |
| 102 DCHECK_NE(NOT_RETRANSMISSION, transmission_type); | 102 DCHECK_NE(NOT_RETRANSMISSION, transmission_type); |
| 103 | 103 |
| 104 TransmissionInfo* transmission_info = | 104 TransmissionInfo* transmission_info = |
| 105 &unacked_packets_.at(old_packet_number - least_unacked_); | 105 &unacked_packets_.at(old_packet_number - least_unacked_); |
| 106 RetransmittableFrames* frames = transmission_info->retransmittable_frames; | 106 RetransmittableFrames* frames = transmission_info->retransmittable_frames; |
| 107 transmission_info->retransmittable_frames = nullptr; | 107 transmission_info->retransmittable_frames = nullptr; |
| 108 for (AckListenerWrapper& wrapper : transmission_info->ack_listeners) { | 108 for (AckListenerWrapper& wrapper : transmission_info->ack_listeners) { |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 QuicTime QuicUnackedPacketMap::GetLastPacketSentTime() const { | 352 QuicTime QuicUnackedPacketMap::GetLastPacketSentTime() const { |
| 353 UnackedPacketMap::const_reverse_iterator it = unacked_packets_.rbegin(); | 353 UnackedPacketMap::const_reverse_iterator it = unacked_packets_.rbegin(); |
| 354 while (it != unacked_packets_.rend()) { | 354 while (it != unacked_packets_.rend()) { |
| 355 if (it->in_flight) { | 355 if (it->in_flight) { |
| 356 LOG_IF(DFATAL, it->sent_time == QuicTime::Zero()) | 356 LOG_IF(DFATAL, it->sent_time == QuicTime::Zero()) |
| 357 << "Sent time can never be zero for a packet in flight."; | 357 << "Sent time can never be zero for a packet in flight."; |
| 358 return it->sent_time; | 358 return it->sent_time; |
| 359 } | 359 } |
| 360 ++it; | 360 ++it; |
| 361 } | 361 } |
| 362 LOG(DFATAL) << "GetLastPacketSentTime requires in flight packets."; | 362 QUIC_BUG << "GetLastPacketSentTime requires in flight packets."; |
| 363 return QuicTime::Zero(); | 363 return QuicTime::Zero(); |
| 364 } | 364 } |
| 365 | 365 |
| 366 size_t QuicUnackedPacketMap::GetNumUnackedPacketsDebugOnly() const { | 366 size_t QuicUnackedPacketMap::GetNumUnackedPacketsDebugOnly() const { |
| 367 size_t unacked_packet_count = 0; | 367 size_t unacked_packet_count = 0; |
| 368 QuicPacketNumber packet_number = least_unacked_; | 368 QuicPacketNumber packet_number = least_unacked_; |
| 369 for (UnackedPacketMap::const_iterator it = unacked_packets_.begin(); | 369 for (UnackedPacketMap::const_iterator it = unacked_packets_.begin(); |
| 370 it != unacked_packets_.end(); ++it, ++packet_number) { | 370 it != unacked_packets_.end(); ++it, ++packet_number) { |
| 371 if (!IsPacketUseless(packet_number, *it)) { | 371 if (!IsPacketUseless(packet_number, *it)) { |
| 372 ++unacked_packet_count; | 372 ++unacked_packet_count; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 return false; | 406 return false; |
| 407 } | 407 } |
| 408 | 408 |
| 409 QuicPacketNumber QuicUnackedPacketMap::GetLeastUnacked() const { | 409 QuicPacketNumber QuicUnackedPacketMap::GetLeastUnacked() const { |
| 410 return least_unacked_; | 410 return least_unacked_; |
| 411 } | 411 } |
| 412 | 412 |
| 413 } // namespace net | 413 } // namespace net |
| OLD | NEW |