Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: net/quic/quic_unacked_packet_map.cc

Issue 1983183002: Landing Recent QUIC changes until 5/14/2016 02:25:25 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "first try to fix link error for win_clang build" Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_unacked_packet_map.h ('k') | net/quic/quic_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_bug_tracker.h" 9 #include "net/quic/quic_bug_tracker.h"
10 #include "net/quic/quic_connection_stats.h" 10 #include "net/quic/quic_connection_stats.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // Transfer the AckListeners if any are present. 116 // Transfer the AckListeners if any are present.
117 info->ack_listeners.swap(transmission_info->ack_listeners); 117 info->ack_listeners.swap(transmission_info->ack_listeners);
118 QUIC_BUG_IF(frames == nullptr) 118 QUIC_BUG_IF(frames == nullptr)
119 << "Attempt to retransmit packet with no " 119 << "Attempt to retransmit packet with no "
120 << "retransmittable frames: " << old_packet_number; 120 << "retransmittable frames: " << old_packet_number;
121 121
122 // Don't link old transmissions to new ones when version or 122 // Don't link old transmissions to new ones when version or
123 // encryption changes. 123 // encryption changes.
124 if (transmission_type == ALL_INITIAL_RETRANSMISSION || 124 if (transmission_type == ALL_INITIAL_RETRANSMISSION ||
125 transmission_type == ALL_UNACKED_RETRANSMISSION) { 125 transmission_type == ALL_UNACKED_RETRANSMISSION) {
126 RemoveAckability(transmission_info); 126 transmission_info->is_unackable = true;
127 } else { 127 } else {
128 transmission_info->retransmission = new_packet_number; 128 transmission_info->retransmission = new_packet_number;
129 } 129 }
130 // Proactively remove obsolete packets so the least unacked can be raised. 130 // Proactively remove obsolete packets so the least unacked can be raised.
131 RemoveObsoletePackets(); 131 RemoveObsoletePackets();
132 } 132 }
133 133
134 bool QuicUnackedPacketMap::HasRetransmittableFrames( 134 bool QuicUnackedPacketMap::HasRetransmittableFrames(
135 QuicPacketNumber packet_number) const { 135 QuicPacketNumber packet_number) const {
136 DCHECK_GE(packet_number, least_unacked_); 136 DCHECK_GE(packet_number, least_unacked_);
(...skipping 21 matching lines...) Expand all
158 } 158 }
159 159
160 void QuicUnackedPacketMap::RemoveRetransmittability( 160 void QuicUnackedPacketMap::RemoveRetransmittability(
161 QuicPacketNumber packet_number) { 161 QuicPacketNumber packet_number) {
162 DCHECK_GE(packet_number, least_unacked_); 162 DCHECK_GE(packet_number, least_unacked_);
163 DCHECK_LT(packet_number, least_unacked_ + unacked_packets_.size()); 163 DCHECK_LT(packet_number, least_unacked_ + unacked_packets_.size());
164 TransmissionInfo* info = &unacked_packets_[packet_number - least_unacked_]; 164 TransmissionInfo* info = &unacked_packets_[packet_number - least_unacked_];
165 RemoveRetransmittability(info); 165 RemoveRetransmittability(info);
166 } 166 }
167 167
168 void QuicUnackedPacketMap::RemoveAckability(TransmissionInfo* info) {
169 DCHECK(info->retransmittable_frames.empty());
170 DCHECK_EQ(0u, info->retransmission);
171 info->is_unackable = true;
172 }
173
174 void QuicUnackedPacketMap::MaybeRemoveRetransmittableFrames( 168 void QuicUnackedPacketMap::MaybeRemoveRetransmittableFrames(
175 TransmissionInfo* transmission_info) { 169 TransmissionInfo* transmission_info) {
176 if (transmission_info->has_crypto_handshake) { 170 if (transmission_info->has_crypto_handshake) {
177 DCHECK(!transmission_info->retransmittable_frames.empty()); 171 DCHECK(!transmission_info->retransmittable_frames.empty());
178 DCHECK_LT(0u, pending_crypto_packet_count_); 172 DCHECK_LT(0u, pending_crypto_packet_count_);
179 --pending_crypto_packet_count_; 173 --pending_crypto_packet_count_;
180 transmission_info->has_crypto_handshake = false; 174 transmission_info->has_crypto_handshake = false;
181 } 175 }
182 QuicUtils::DeleteFrames(&transmission_info->retransmittable_frames); 176 QuicUtils::DeleteFrames(&transmission_info->retransmittable_frames);
183 } 177 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 247 }
254 } 248 }
255 249
256 void QuicUnackedPacketMap::RemoveFromInFlight(QuicPacketNumber packet_number) { 250 void QuicUnackedPacketMap::RemoveFromInFlight(QuicPacketNumber packet_number) {
257 DCHECK_GE(packet_number, least_unacked_); 251 DCHECK_GE(packet_number, least_unacked_);
258 DCHECK_LT(packet_number, least_unacked_ + unacked_packets_.size()); 252 DCHECK_LT(packet_number, least_unacked_ + unacked_packets_.size());
259 TransmissionInfo* info = &unacked_packets_[packet_number - least_unacked_]; 253 TransmissionInfo* info = &unacked_packets_[packet_number - least_unacked_];
260 RemoveFromInFlight(info); 254 RemoveFromInFlight(info);
261 } 255 }
262 256
257 void QuicUnackedPacketMap::RestoreToInFlight(QuicPacketNumber packet_number) {
258 DCHECK_GE(packet_number, least_unacked_);
259 DCHECK_LT(packet_number, least_unacked_ + unacked_packets_.size());
260 TransmissionInfo* info = &unacked_packets_[packet_number - least_unacked_];
261 DCHECK(!info->is_unackable);
262 bytes_in_flight_ += info->bytes_sent;
263 info->in_flight = true;
264 }
265
263 void QuicUnackedPacketMap::CancelRetransmissionsForStream( 266 void QuicUnackedPacketMap::CancelRetransmissionsForStream(
264 QuicStreamId stream_id) { 267 QuicStreamId stream_id) {
265 QuicPacketNumber packet_number = least_unacked_; 268 QuicPacketNumber packet_number = least_unacked_;
266 for (UnackedPacketMap::iterator it = unacked_packets_.begin(); 269 for (UnackedPacketMap::iterator it = unacked_packets_.begin();
267 it != unacked_packets_.end(); ++it, ++packet_number) { 270 it != unacked_packets_.end(); ++it, ++packet_number) {
268 QuicFrames* frames = &it->retransmittable_frames; 271 QuicFrames* frames = &it->retransmittable_frames;
269 if (frames->empty()) { 272 if (frames->empty()) {
270 continue; 273 continue;
271 } 274 }
272 QuicUtils::RemoveFramesForStream(frames, stream_id); 275 QuicUtils::RemoveFramesForStream(frames, stream_id);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 } 352 }
350 } 353 }
351 return false; 354 return false;
352 } 355 }
353 356
354 QuicPacketNumber QuicUnackedPacketMap::GetLeastUnacked() const { 357 QuicPacketNumber QuicUnackedPacketMap::GetLeastUnacked() const {
355 return least_unacked_; 358 return least_unacked_;
356 } 359 }
357 360
358 } // namespace net 361 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_unacked_packet_map.h ('k') | net/quic/quic_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698