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 "net/base/linked_hash_map.h" | 8 #include "net/base/linked_hash_map.h" |
9 #include "net/quic/quic_protocol.h" | 9 #include "net/quic/quic_protocol.h" |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // Returns the number of unacked packets. | 104 // Returns the number of unacked packets. |
105 size_t GetNumUnackedPackets() const; | 105 size_t GetNumUnackedPackets() const; |
106 | 106 |
107 // Returns true if there are multiple packet pending. | 107 // Returns true if there are multiple packet pending. |
108 bool HasMultiplePendingPackets() const; | 108 bool HasMultiplePendingPackets() const; |
109 | 109 |
110 // Returns true if there are any pending crypto packets. | 110 // Returns true if there are any pending crypto packets. |
111 bool HasPendingCryptoPackets() const; | 111 bool HasPendingCryptoPackets() const; |
112 | 112 |
113 // Removes any retransmittable frames from this transmission or an associated | 113 // Removes any retransmittable frames from this transmission or an associated |
114 // transmission. It removes any nnon-pending transmissions less than or | |
115 // equal to |largest_observed|, and disconnects any other packets from other | |
116 // transmissions. | |
117 // TODO(ianswett): Remove largest_observed_ once the map tracks whether a | |
118 // transmission is useful for RTT purposes internally. | |
119 void RemoveRetransmittability(QuicPacketSequenceNumber sequence_number, | |
120 QuicPacketSequenceNumber largest_observed_); | |
121 | 114 |
122 // Removes an entry from the unacked packet map which is not pending, has | 115 // transmission. It removes now useless transmissions, and disconnects any |
123 // no retransmittable frames, and no associated transmissions. | 116 // other packets from other transmissions. |
124 // TODO(ianswett): Remove or make this method private once the map tracks | 117 void RemoveRetransmittability(QuicPacketSequenceNumber sequence_number); |
125 // the three reasons for tracking a packet correctly. | |
126 void RemoveRttOnlyPacket(QuicPacketSequenceNumber sequence_number); | |
127 | 118 |
128 // Returns true if the packet's only purpose is to measure RTT. It must not | 119 // Increases the largest observed. Any packets less or equal to |
129 // be pending, have retransmittable frames, or be linked to transmissions | 120 // |largest_acked_packet| are discarded if they are only for the RTT purposes. |
130 // with retransmittable frames. | 121 void IncreaseLargestObserved(QuicPacketSequenceNumber largest_observed); |
131 static bool IsForRttOnly(const TransmissionInfo& transmission_info); | |
132 | 122 |
133 private: | 123 private: |
134 void MaybeRemoveRetransmittableFrames(TransmissionInfo* transmission_info); | 124 void MaybeRemoveRetransmittableFrames(TransmissionInfo* transmission_info); |
135 | 125 |
| 126 // Returns true if the packet no longer has a purpose in the map. |
| 127 bool IsPacketUseless(UnackedPacketMap::const_iterator it); |
| 128 |
136 QuicPacketSequenceNumber largest_sent_packet_; | 129 QuicPacketSequenceNumber largest_sent_packet_; |
| 130 QuicPacketSequenceNumber largest_observed_; |
137 | 131 |
138 // Newly serialized retransmittable and fec packets are added to this map, | 132 // Newly serialized retransmittable and fec packets are added to this map, |
139 // which contains owning pointers to any contained frames. If a packet is | 133 // which contains owning pointers to any contained frames. If a packet is |
140 // retransmitted, this map will contain entries for both the old and the new | 134 // retransmitted, this map will contain entries for both the old and the new |
141 // packet. The old packet's retransmittable frames entry will be NULL, while | 135 // packet. The old packet's retransmittable frames entry will be NULL, while |
142 // the new packet's entry will contain the frames to retransmit. | 136 // the new packet's entry will contain the frames to retransmit. |
143 // If the old packet is acked before the new packet, then the old entry will | 137 // If the old packet is acked before the new packet, then the old entry will |
144 // be removed from the map and the new entry's retransmittable frames will be | 138 // be removed from the map and the new entry's retransmittable frames will be |
145 // set to NULL. | 139 // set to NULL. |
146 UnackedPacketMap unacked_packets_; | 140 UnackedPacketMap unacked_packets_; |
147 | 141 |
148 size_t bytes_in_flight_; | 142 size_t bytes_in_flight_; |
149 // Number of outstanding crypto handshake packets. | 143 // Number of outstanding crypto handshake packets. |
150 size_t pending_crypto_packet_count_; | 144 size_t pending_crypto_packet_count_; |
151 | 145 |
152 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap); | 146 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap); |
153 }; | 147 }; |
154 | 148 |
155 } // namespace net | 149 } // namespace net |
156 | 150 |
157 #endif // NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ | 151 #endif // NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ |
OLD | NEW |