| 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_CORE_QUIC_UNACKED_PACKET_MAP_H_ | 5 #ifndef NET_QUIC_CORE_QUIC_UNACKED_PACKET_MAP_H_ |
| 6 #define NET_QUIC_CORE_QUIC_UNACKED_PACKET_MAP_H_ | 6 #define NET_QUIC_CORE_QUIC_UNACKED_PACKET_MAP_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <deque> | 9 #include <deque> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "net/quic/core/quic_packets.h" | 12 #include "net/quic/core/quic_packets.h" |
| 13 #include "net/quic/core/quic_transmission_info.h" | 13 #include "net/quic/core/quic_transmission_info.h" |
| 14 #include "net/quic/core/stream_notifier_interface.h" |
| 14 #include "net/quic/platform/api/quic_export.h" | 15 #include "net/quic/platform/api/quic_export.h" |
| 15 | 16 |
| 16 namespace net { | 17 namespace net { |
| 17 | 18 |
| 18 // Class which tracks unacked packets for three purposes: | 19 // Class which tracks unacked packets for three purposes: |
| 19 // 1) Track retransmittable data, including multiple transmissions of frames. | 20 // 1) Track retransmittable data, including multiple transmissions of frames. |
| 20 // 2) Track packets and bytes in flight for congestion control. | 21 // 2) Track packets and bytes in flight for congestion control. |
| 21 // 3) Track sent time of packets to provide RTT measurements from acks. | 22 // 3) Track sent time of packets to provide RTT measurements from acks. |
| 22 class QUIC_EXPORT_PRIVATE QuicUnackedPacketMap { | 23 class QUIC_EXPORT_PRIVATE QuicUnackedPacketMap { |
| 23 public: | 24 public: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 43 | 44 |
| 44 // Notifies all the AckListeners attached to the |info| and | 45 // Notifies all the AckListeners attached to the |info| and |
| 45 // clears them to ensure they're not notified again. | 46 // clears them to ensure they're not notified again. |
| 46 void NotifyAndClearListeners(std::list<AckListenerWrapper>* ack_listeners, | 47 void NotifyAndClearListeners(std::list<AckListenerWrapper>* ack_listeners, |
| 47 QuicTime::Delta delta_largest_observed); | 48 QuicTime::Delta delta_largest_observed); |
| 48 | 49 |
| 49 // Notifies all the AckListeners attached to |newest_transmission|. | 50 // Notifies all the AckListeners attached to |newest_transmission|. |
| 50 void NotifyAndClearListeners(QuicPacketNumber newest_transmission, | 51 void NotifyAndClearListeners(QuicPacketNumber newest_transmission, |
| 51 QuicTime::Delta delta_largest_observed); | 52 QuicTime::Delta delta_largest_observed); |
| 52 | 53 |
| 54 // Notifies stream_notifier that stream frames have been acked. |
| 55 void NotifyStreamFramesAcked(const QuicTransmissionInfo& info, |
| 56 QuicTime::Delta ack_delay); |
| 57 |
| 53 // Marks |info| as no longer in flight. | 58 // Marks |info| as no longer in flight. |
| 54 void RemoveFromInFlight(QuicTransmissionInfo* info); | 59 void RemoveFromInFlight(QuicTransmissionInfo* info); |
| 55 | 60 |
| 56 // Marks |packet_number| as no longer in flight. | 61 // Marks |packet_number| as no longer in flight. |
| 57 void RemoveFromInFlight(QuicPacketNumber packet_number); | 62 void RemoveFromInFlight(QuicPacketNumber packet_number); |
| 58 | 63 |
| 59 // Marks |packet_number| as in flight. Must not be unackable. | 64 // Marks |packet_number| as in flight. Must not be unackable. |
| 60 void RestoreToInFlight(QuicPacketNumber packet_number); | 65 void RestoreToInFlight(QuicPacketNumber packet_number); |
| 61 | 66 |
| 62 // No longer retransmit data for |stream_id|. | 67 // No longer retransmit data for |stream_id|. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 void RemoveRetransmittability(QuicPacketNumber packet_number); | 144 void RemoveRetransmittability(QuicPacketNumber packet_number); |
| 140 | 145 |
| 141 // Increases the largest observed. Any packets less or equal to | 146 // Increases the largest observed. Any packets less or equal to |
| 142 // |largest_acked_packet| are discarded if they are only for the RTT purposes. | 147 // |largest_acked_packet| are discarded if they are only for the RTT purposes. |
| 143 void IncreaseLargestObserved(QuicPacketNumber largest_observed); | 148 void IncreaseLargestObserved(QuicPacketNumber largest_observed); |
| 144 | 149 |
| 145 // Remove any packets no longer needed for retransmission, congestion, or | 150 // Remove any packets no longer needed for retransmission, congestion, or |
| 146 // RTT measurement purposes. | 151 // RTT measurement purposes. |
| 147 void RemoveObsoletePackets(); | 152 void RemoveObsoletePackets(); |
| 148 | 153 |
| 154 void SetStreamNotifier(StreamNotifierInterface* stream_notifier); |
| 155 |
| 149 private: | 156 private: |
| 150 // Called when a packet is retransmitted with a new packet number. | 157 // Called when a packet is retransmitted with a new packet number. |
| 151 // |old_packet_number| will remain unacked, but will have no | 158 // |old_packet_number| will remain unacked, but will have no |
| 152 // retransmittable data associated with it. Retransmittable frames will be | 159 // retransmittable data associated with it. Retransmittable frames will be |
| 153 // transferred to |info| and all_transmissions will be populated. | 160 // transferred to |info| and all_transmissions will be populated. |
| 154 void TransferRetransmissionInfo(QuicPacketNumber old_packet_number, | 161 void TransferRetransmissionInfo(QuicPacketNumber old_packet_number, |
| 155 QuicPacketNumber new_packet_number, | 162 QuicPacketNumber new_packet_number, |
| 156 TransmissionType transmission_type, | 163 TransmissionType transmission_type, |
| 157 QuicTransmissionInfo* info); | 164 QuicTransmissionInfo* info); |
| 158 | 165 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 187 // be removed from the map and the new entry's retransmittable frames will be | 194 // be removed from the map and the new entry's retransmittable frames will be |
| 188 // set to nullptr. | 195 // set to nullptr. |
| 189 UnackedPacketMap unacked_packets_; | 196 UnackedPacketMap unacked_packets_; |
| 190 // The packet at the 0th index of unacked_packets_. | 197 // The packet at the 0th index of unacked_packets_. |
| 191 QuicPacketNumber least_unacked_; | 198 QuicPacketNumber least_unacked_; |
| 192 | 199 |
| 193 QuicByteCount bytes_in_flight_; | 200 QuicByteCount bytes_in_flight_; |
| 194 // Number of retransmittable crypto handshake packets. | 201 // Number of retransmittable crypto handshake packets. |
| 195 size_t pending_crypto_packet_count_; | 202 size_t pending_crypto_packet_count_; |
| 196 | 203 |
| 204 // Receives notifications of stream frames being retransmitted or |
| 205 // acknowledged. |
| 206 StreamNotifierInterface* stream_notifier_; |
| 207 |
| 197 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap); | 208 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap); |
| 198 }; | 209 }; |
| 199 | 210 |
| 200 } // namespace net | 211 } // namespace net |
| 201 | 212 |
| 202 #endif // NET_QUIC_CORE_QUIC_UNACKED_PACKET_MAP_H_ | 213 #endif // NET_QUIC_CORE_QUIC_UNACKED_PACKET_MAP_H_ |
| OLD | NEW |