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

Side by Side Diff: net/quic/quic_sent_packet_manager.h

Issue 109323012: Cleanup in QUIC to merge the previous_transmissions_map in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/quic/quic_sent_packet_manager.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ 5 #ifndef NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_
6 #define NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ 6 #define NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 198
199 private: 199 private:
200 friend class test::QuicConnectionPeer; 200 friend class test::QuicConnectionPeer;
201 friend class test::QuicSentPacketManagerPeer; 201 friend class test::QuicSentPacketManagerPeer;
202 202
203 struct TransmissionInfo { 203 struct TransmissionInfo {
204 TransmissionInfo() 204 TransmissionInfo()
205 : retransmittable_frames(NULL), 205 : retransmittable_frames(NULL),
206 sequence_number_length(PACKET_1BYTE_SEQUENCE_NUMBER), 206 sequence_number_length(PACKET_1BYTE_SEQUENCE_NUMBER),
207 sent_time(QuicTime::Zero()) { } 207 sent_time(QuicTime::Zero()),
208 previous_transmissions(NULL) { }
208 TransmissionInfo(RetransmittableFrames* retransmittable_frames, 209 TransmissionInfo(RetransmittableFrames* retransmittable_frames,
209 QuicSequenceNumberLength sequence_number_length) 210 QuicSequenceNumberLength sequence_number_length)
210 : retransmittable_frames(retransmittable_frames), 211 : retransmittable_frames(retransmittable_frames),
211 sequence_number_length(sequence_number_length), 212 sequence_number_length(sequence_number_length),
212 sent_time(QuicTime::Zero()) { 213 sent_time(QuicTime::Zero()),
214 previous_transmissions(NULL) {
213 } 215 }
214 216
215 RetransmittableFrames* retransmittable_frames; 217 RetransmittableFrames* retransmittable_frames;
216 QuicSequenceNumberLength sequence_number_length; 218 QuicSequenceNumberLength sequence_number_length;
217 // Zero when the packet is serialized, non-zero once it's sent. 219 // Zero when the packet is serialized, non-zero once it's sent.
218 QuicTime sent_time; 220 QuicTime sent_time;
221 // Stores all previous transmissions if the packet has been retransmitted,
222 // and is NULL otherwise.
223 SequenceNumberSet* previous_transmissions;
219 }; 224 };
220 225
221 typedef linked_hash_map<QuicPacketSequenceNumber, 226 typedef linked_hash_map<QuicPacketSequenceNumber,
222 TransmissionInfo> UnackedPacketMap; 227 TransmissionInfo> UnackedPacketMap;
223 typedef linked_hash_map<QuicPacketSequenceNumber, 228 typedef linked_hash_map<QuicPacketSequenceNumber,
224 TransmissionType> PendingRetransmissionMap; 229 TransmissionType> PendingRetransmissionMap;
225 typedef base::hash_map<QuicPacketSequenceNumber, SequenceNumberSet*> 230 typedef base::hash_map<QuicPacketSequenceNumber, SequenceNumberSet*>
226 PreviousTransmissionMap; 231 PreviousTransmissionMap;
227 232
228 // Process the incoming ack looking for newly ack'd data packets. 233 // Process the incoming ack looking for newly ack'd data packets.
(...skipping 16 matching lines...) Expand all
245 // retransmissions. Returns false if there are no retransmittable frames for 250 // retransmissions. Returns false if there are no retransmittable frames for
246 // |sequence_number| and true if it will be retransmitted. 251 // |sequence_number| and true if it will be retransmitted.
247 bool MarkForRetransmission(QuicPacketSequenceNumber sequence_number, 252 bool MarkForRetransmission(QuicPacketSequenceNumber sequence_number,
248 TransmissionType transmission_type); 253 TransmissionType transmission_type);
249 254
250 // Returns the length of the serialized sequence number for 255 // Returns the length of the serialized sequence number for
251 // the packet |sequence_number|. 256 // the packet |sequence_number|.
252 QuicSequenceNumberLength GetSequenceNumberLength( 257 QuicSequenceNumberLength GetSequenceNumberLength(
253 QuicPacketSequenceNumber sequence_number) const; 258 QuicPacketSequenceNumber sequence_number) const;
254 259
255 // Returns the sequence number of the packet that |sequence_number| was
256 // most recently transmitted as.
257 QuicPacketSequenceNumber GetMostRecentTransmission(
258 QuicPacketSequenceNumber sequence_number) const;
259
260 // Clears up to |num_to_clear| previous transmissions in order to make room 260 // Clears up to |num_to_clear| previous transmissions in order to make room
261 // in the ack frame for new acks. 261 // in the ack frame for new acks.
262 void ClearPreviousRetransmissions(size_t num_to_clear); 262 void ClearPreviousRetransmissions(size_t num_to_clear);
263 263
264 void CleanupPacketHistory(); 264 void CleanupPacketHistory();
265 265
266 // Newly serialized retransmittable and fec packets are added to this map, 266 // Newly serialized retransmittable and fec packets are added to this map,
267 // which contains owning pointers to any contained frames. If a packet is 267 // which contains owning pointers to any contained frames. If a packet is
268 // retransmitted, this map will contain entries for both the old and the new 268 // retransmitted, this map will contain entries for both the old and the new
269 // packet. The old packet's retransmittable frames entry will be NULL, while 269 // packet. The old packet's retransmittable frames entry will be NULL, while
270 // the new packet's entry will contain the frames to retransmit. 270 // the new packet's entry will contain the frames to retransmit.
271 // If the old packet is acked before the new packet, then the old entry will 271 // If the old packet is acked before the new packet, then the old entry will
272 // be removed from the map and the new entry's retransmittable frames will be 272 // be removed from the map and the new entry's retransmittable frames will be
273 // set to NULL. 273 // set to NULL.
274 UnackedPacketMap unacked_packets_; 274 UnackedPacketMap unacked_packets_;
275 275
276 // Pending retransmissions which have not been packetized and sent yet. 276 // Pending retransmissions which have not been packetized and sent yet.
277 PendingRetransmissionMap pending_retransmissions_; 277 PendingRetransmissionMap pending_retransmissions_;
278 278
279 // Map from sequence number to set of all sequence number that this packet has
280 // been transmitted as. If a packet has not been retransmitted, it will not
281 // have an entry in this map. If any transmission of a packet has been acked
282 // it will not have an entry in this map.
283 PreviousTransmissionMap previous_transmissions_map_;
284
285 // Tracks if the connection was created by the server. 279 // Tracks if the connection was created by the server.
286 bool is_server_; 280 bool is_server_;
287 281
288 HelperInterface* helper_; 282 HelperInterface* helper_;
289 283
290 // An AckNotifier can register to be informed when ACKs have been received for 284 // An AckNotifier can register to be informed when ACKs have been received for
291 // all packets that a given block of data was sent in. The AckNotifierManager 285 // all packets that a given block of data was sent in. The AckNotifierManager
292 // maintains the currently active notifiers. 286 // maintains the currently active notifiers.
293 AckNotifierManager ack_notifier_manager_; 287 AckNotifierManager ack_notifier_manager_;
294 288
295 const QuicClock* clock_; 289 const QuicClock* clock_;
296 scoped_ptr<SendAlgorithmInterface> send_algorithm_; 290 scoped_ptr<SendAlgorithmInterface> send_algorithm_;
297 // Tracks the send time, size, and nack count of sent packets. Packets are 291 // Tracks the send time, size, and nack count of sent packets. Packets are
298 // removed after 5 seconds and they've been removed from pending_packets_. 292 // removed after 5 seconds and they've been removed from pending_packets_.
299 SendAlgorithmInterface::SentPacketsMap packet_history_map_; 293 SendAlgorithmInterface::SentPacketsMap packet_history_map_;
300 // Packets that are outstanding and have not been abandoned or lost. 294 // Packets that are outstanding and have not been abandoned or lost.
301 SequenceNumberSet pending_packets_; 295 SequenceNumberSet pending_packets_;
302 QuicTime::Delta rtt_sample_; // RTT estimate from the most recent ACK. 296 QuicTime::Delta rtt_sample_; // RTT estimate from the most recent ACK.
303 // Number of times the RTO timer has fired in a row without receiving an ack. 297 // Number of times the RTO timer has fired in a row without receiving an ack.
304 size_t consecutive_rto_count_; 298 size_t consecutive_rto_count_;
305 bool using_pacing_; 299 bool using_pacing_;
306 300
307 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager); 301 DISALLOW_COPY_AND_ASSIGN(QuicSentPacketManager);
308 }; 302 };
309 303
310 } // namespace net 304 } // namespace net
311 305
312 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_ 306 #endif // NET_QUIC_QUIC_SENT_PACKET_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_sent_packet_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698