| 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 #ifndef NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ | 5 #ifndef NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ |
| 6 #define NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ | 6 #define NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "net/quic/quic_protocol.h" | 10 #include "net/quic/quic_protocol.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // Packets marked as in flight are expected to be marked as missing when they | 79 // Packets marked as in flight are expected to be marked as missing when they |
| 80 // don't arrive, indicating the need for retransmission. | 80 // don't arrive, indicating the need for retransmission. |
| 81 void SetSent(QuicPacketSequenceNumber sequence_number, | 81 void SetSent(QuicPacketSequenceNumber sequence_number, |
| 82 QuicTime sent_time, | 82 QuicTime sent_time, |
| 83 QuicByteCount bytes_sent, | 83 QuicByteCount bytes_sent, |
| 84 bool set_in_flight); | 84 bool set_in_flight); |
| 85 | 85 |
| 86 // Restores the in flight status for a packet that was previously sent. | 86 // Restores the in flight status for a packet that was previously sent. |
| 87 void RestoreInFlight(QuicPacketSequenceNumber sequence_number); | 87 void RestoreInFlight(QuicPacketSequenceNumber sequence_number); |
| 88 | 88 |
| 89 // Clears up to |num_to_clear| previous transmissions in order to make room | 89 // Clears all previous transmissions in order to make room in the ack frame |
| 90 // in the ack frame for new acks. | 90 // for newly acked packets. |
| 91 void ClearPreviousRetransmissions(size_t num_to_clear); | 91 void ClearAllPreviousRetransmissions(); |
| 92 | 92 |
| 93 typedef std::deque<TransmissionInfo> UnackedPacketMap; | 93 typedef std::deque<TransmissionInfo> UnackedPacketMap; |
| 94 | 94 |
| 95 typedef UnackedPacketMap::const_iterator const_iterator; | 95 typedef UnackedPacketMap::const_iterator const_iterator; |
| 96 | 96 |
| 97 const_iterator begin() const { return unacked_packets_.begin(); } | 97 const_iterator begin() const { return unacked_packets_.begin(); } |
| 98 const_iterator end() const { return unacked_packets_.end(); } | 98 const_iterator end() const { return unacked_packets_.end(); } |
| 99 | 99 |
| 100 // Returns true if there are unacked packets that are in flight. | 100 // Returns true if there are unacked packets that are in flight. |
| 101 bool HasInFlightPackets() const; | 101 bool HasInFlightPackets() const; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 132 // Remove any packets no longer needed for retransmission, congestion, or | 132 // Remove any packets no longer needed for retransmission, congestion, or |
| 133 // RTT measurement purposes. | 133 // RTT measurement purposes. |
| 134 void RemoveObsoletePackets(); | 134 void RemoveObsoletePackets(); |
| 135 | 135 |
| 136 private: | 136 private: |
| 137 void MaybeRemoveRetransmittableFrames(TransmissionInfo* transmission_info); | 137 void MaybeRemoveRetransmittableFrames(TransmissionInfo* transmission_info); |
| 138 | 138 |
| 139 // Returns true if the packet no longer has a purpose in the map. | 139 // Returns true if the packet no longer has a purpose in the map. |
| 140 bool IsPacketUseless(QuicPacketSequenceNumber sequence_number, | 140 bool IsPacketUseless(QuicPacketSequenceNumber sequence_number, |
| 141 const TransmissionInfo& info) const; | 141 const TransmissionInfo& info) const; |
| 142 // Returns true if the packet is useless or it's only purpose is RTT |
| 143 // measurement, and it's old enough that is unlikely to ever happen. |
| 144 bool IsPacketRemovable(QuicPacketSequenceNumber sequence_number, |
| 145 const TransmissionInfo& info) const; |
| 142 | 146 |
| 143 QuicPacketSequenceNumber largest_sent_packet_; | 147 QuicPacketSequenceNumber largest_sent_packet_; |
| 144 QuicPacketSequenceNumber largest_observed_; | 148 QuicPacketSequenceNumber largest_observed_; |
| 145 | 149 |
| 146 // Newly serialized retransmittable and fec packets are added to this map, | 150 // Newly serialized retransmittable and fec packets are added to this map, |
| 147 // which contains owning pointers to any contained frames. If a packet is | 151 // which contains owning pointers to any contained frames. If a packet is |
| 148 // retransmitted, this map will contain entries for both the old and the new | 152 // retransmitted, this map will contain entries for both the old and the new |
| 149 // packet. The old packet's retransmittable frames entry will be NULL, while | 153 // packet. The old packet's retransmittable frames entry will be NULL, while |
| 150 // the new packet's entry will contain the frames to retransmit. | 154 // the new packet's entry will contain the frames to retransmit. |
| 151 // If the old packet is acked before the new packet, then the old entry will | 155 // If the old packet is acked before the new packet, then the old entry will |
| 152 // be removed from the map and the new entry's retransmittable frames will be | 156 // be removed from the map and the new entry's retransmittable frames will be |
| 153 // set to NULL. | 157 // set to NULL. |
| 154 UnackedPacketMap unacked_packets_; | 158 UnackedPacketMap unacked_packets_; |
| 155 // The packet at the 0th index of unacked_packets_. | 159 // The packet at the 0th index of unacked_packets_. |
| 156 QuicPacketSequenceNumber least_unacked_; | 160 QuicPacketSequenceNumber least_unacked_; |
| 157 | 161 |
| 158 size_t bytes_in_flight_; | 162 size_t bytes_in_flight_; |
| 159 // Number of retransmittable crypto handshake packets. | 163 // Number of retransmittable crypto handshake packets. |
| 160 size_t pending_crypto_packet_count_; | 164 size_t pending_crypto_packet_count_; |
| 161 | 165 |
| 162 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap); | 166 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap); |
| 163 }; | 167 }; |
| 164 | 168 |
| 165 } // namespace net | 169 } // namespace net |
| 166 | 170 |
| 167 #endif // NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ | 171 #endif // NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ |
| OLD | NEW |