| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 void QuicUnackedPacketMap::ClearPreviousRetransmissions(size_t num_to_clear) { | 110 void QuicUnackedPacketMap::ClearPreviousRetransmissions(size_t num_to_clear) { |
| 111 while (!unacked_packets_.empty() && num_to_clear > 0) { | 111 while (!unacked_packets_.empty() && num_to_clear > 0) { |
| 112 // If this packet is in flight, or has retransmittable data, then there is | 112 // If this packet is in flight, or has retransmittable data, then there is |
| 113 // no point in clearing out any further packets, because they would not | 113 // no point in clearing out any further packets, because they would not |
| 114 // affect the high water mark. | 114 // affect the high water mark. |
| 115 TransmissionInfo* info = &unacked_packets_.front(); | 115 TransmissionInfo* info = &unacked_packets_.front(); |
| 116 if (info->in_flight || info->retransmittable_frames != NULL) { | 116 if (info->in_flight || info->retransmittable_frames != NULL) { |
| 117 break; | 117 break; |
| 118 } | 118 } |
| 119 | 119 |
| 120 info->all_transmissions->pop_front(); | 120 if (info->all_transmissions != NULL) { |
| 121 LOG_IF(DFATAL, info->all_transmissions->empty()) | 121 if (info->all_transmissions->size() < 2) { |
| 122 << "Previous retransmissions must have a newer transmission."; | 122 LOG(DFATAL) << "all_transmissions must be NULL or have multiple " |
| 123 << "elements. size:" << info->all_transmissions->size(); |
| 124 delete info->all_transmissions; |
| 125 } else { |
| 126 info->all_transmissions->pop_front(); |
| 127 if (info->all_transmissions->size() == 1) { |
| 128 // Set the newer transmission's 'all_transmissions' entry to NULL. |
| 129 QuicPacketSequenceNumber new_transmission = |
| 130 info->all_transmissions->front(); |
| 131 TransmissionInfo* new_info = |
| 132 &unacked_packets_.at(new_transmission - least_unacked_); |
| 133 delete new_info->all_transmissions; |
| 134 new_info->all_transmissions = NULL; |
| 135 } |
| 136 } |
| 137 } |
| 123 unacked_packets_.pop_front(); | 138 unacked_packets_.pop_front(); |
| 124 ++least_unacked_; | 139 ++least_unacked_; |
| 125 --num_to_clear; | 140 --num_to_clear; |
| 126 } | 141 } |
| 127 } | 142 } |
| 128 | 143 |
| 129 bool QuicUnackedPacketMap::HasRetransmittableFrames( | 144 bool QuicUnackedPacketMap::HasRetransmittableFrames( |
| 130 QuicPacketSequenceNumber sequence_number) const { | 145 QuicPacketSequenceNumber sequence_number) const { |
| 131 DCHECK_GE(sequence_number, least_unacked_); | 146 DCHECK_GE(sequence_number, least_unacked_); |
| 132 DCHECK_LT(sequence_number, least_unacked_ + unacked_packets_.size()); | 147 DCHECK_LT(sequence_number, least_unacked_ + unacked_packets_.size()); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 TransmissionInfo* info = &unacked_packets_[sequence_number - least_unacked_]; | 339 TransmissionInfo* info = &unacked_packets_[sequence_number - least_unacked_]; |
| 325 DCHECK(!info->in_flight); | 340 DCHECK(!info->in_flight); |
| 326 DCHECK_NE(0u, info->bytes_sent); | 341 DCHECK_NE(0u, info->bytes_sent); |
| 327 DCHECK(info->sent_time.IsInitialized()); | 342 DCHECK(info->sent_time.IsInitialized()); |
| 328 | 343 |
| 329 bytes_in_flight_ += info->bytes_sent; | 344 bytes_in_flight_ += info->bytes_sent; |
| 330 info->in_flight = true; | 345 info->in_flight = true; |
| 331 } | 346 } |
| 332 | 347 |
| 333 } // namespace net | 348 } // namespace net |
| OLD | NEW |