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/core/quic_unacked_packet_map.h" | 5 #include "net/quic/core/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/chromium/quic_utils_chromium.h" | 9 #include "net/quic/chromium/quic_utils_chromium.h" |
10 #include "net/quic/core/quic_bug_tracker.h" | 10 #include "net/quic/core/quic_bug_tracker.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 .retransmittable_frames.empty(); | 143 .retransmittable_frames.empty(); |
144 } | 144 } |
145 | 145 |
146 void QuicUnackedPacketMap::RemoveRetransmittability( | 146 void QuicUnackedPacketMap::RemoveRetransmittability( |
147 QuicTransmissionInfo* info) { | 147 QuicTransmissionInfo* info) { |
148 while (info->retransmission != 0) { | 148 while (info->retransmission != 0) { |
149 const QuicPacketNumber retransmission = info->retransmission; | 149 const QuicPacketNumber retransmission = info->retransmission; |
150 info->retransmission = 0; | 150 info->retransmission = 0; |
151 info = &unacked_packets_[retransmission - least_unacked_]; | 151 info = &unacked_packets_[retransmission - least_unacked_]; |
152 } | 152 } |
153 MaybeRemoveRetransmittableFrames(info); | 153 |
| 154 if (info->has_crypto_handshake) { |
| 155 DCHECK(!info->retransmittable_frames.empty()); |
| 156 DCHECK_LT(0u, pending_crypto_packet_count_); |
| 157 --pending_crypto_packet_count_; |
| 158 info->has_crypto_handshake = false; |
| 159 } |
| 160 DeleteFrames(&info->retransmittable_frames); |
154 } | 161 } |
155 | 162 |
156 void QuicUnackedPacketMap::RemoveRetransmittability( | 163 void QuicUnackedPacketMap::RemoveRetransmittability( |
157 QuicPacketNumber packet_number) { | 164 QuicPacketNumber packet_number) { |
158 DCHECK_GE(packet_number, least_unacked_); | 165 DCHECK_GE(packet_number, least_unacked_); |
159 DCHECK_LT(packet_number, least_unacked_ + unacked_packets_.size()); | 166 DCHECK_LT(packet_number, least_unacked_ + unacked_packets_.size()); |
160 QuicTransmissionInfo* info = | 167 QuicTransmissionInfo* info = |
161 &unacked_packets_[packet_number - least_unacked_]; | 168 &unacked_packets_[packet_number - least_unacked_]; |
162 RemoveRetransmittability(info); | 169 RemoveRetransmittability(info); |
163 } | 170 } |
164 | 171 |
165 void QuicUnackedPacketMap::MaybeRemoveRetransmittableFrames( | |
166 QuicTransmissionInfo* transmission_info) { | |
167 if (transmission_info->has_crypto_handshake) { | |
168 DCHECK(!transmission_info->retransmittable_frames.empty()); | |
169 DCHECK_LT(0u, pending_crypto_packet_count_); | |
170 --pending_crypto_packet_count_; | |
171 transmission_info->has_crypto_handshake = false; | |
172 } | |
173 DeleteFrames(&transmission_info->retransmittable_frames); | |
174 } | |
175 | |
176 void QuicUnackedPacketMap::IncreaseLargestObserved( | 172 void QuicUnackedPacketMap::IncreaseLargestObserved( |
177 QuicPacketNumber largest_observed) { | 173 QuicPacketNumber largest_observed) { |
178 DCHECK_LE(largest_observed_, largest_observed); | 174 DCHECK_LE(largest_observed_, largest_observed); |
179 largest_observed_ = largest_observed; | 175 largest_observed_ = largest_observed; |
180 } | 176 } |
181 | 177 |
182 bool QuicUnackedPacketMap::IsPacketUsefulForMeasuringRtt( | 178 bool QuicUnackedPacketMap::IsPacketUsefulForMeasuringRtt( |
183 QuicPacketNumber packet_number, | 179 QuicPacketNumber packet_number, |
184 const QuicTransmissionInfo& info) const { | 180 const QuicTransmissionInfo& info) const { |
185 // Packet can be used for RTT measurement if it may yet be acked as the | 181 // Packet can be used for RTT measurement if it may yet be acked as the |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 } | 349 } |
354 } | 350 } |
355 return false; | 351 return false; |
356 } | 352 } |
357 | 353 |
358 QuicPacketNumber QuicUnackedPacketMap::GetLeastUnacked() const { | 354 QuicPacketNumber QuicUnackedPacketMap::GetLeastUnacked() const { |
359 return least_unacked_; | 355 return least_unacked_; |
360 } | 356 } |
361 | 357 |
362 } // namespace net | 358 } // namespace net |
OLD | NEW |