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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 // Returns the number of unacked packets. | 114 // Returns the number of unacked packets. |
115 size_t GetNumUnackedPackets() const; | 115 size_t GetNumUnackedPackets() const; |
116 | 116 |
117 // Returns true if there are multiple packet pending. | 117 // Returns true if there are multiple packet pending. |
118 bool HasMultiplePendingPackets() const; | 118 bool HasMultiplePendingPackets() const; |
119 | 119 |
120 // Returns true if there are any pending crypto packets. | 120 // Returns true if there are any pending crypto packets. |
121 bool HasPendingCryptoPackets() const; | 121 bool HasPendingCryptoPackets() const; |
122 | 122 |
123 // Removes entries from the unacked packet map, and deletes | 123 // Deletes the retransmittable frames associated with the packet and removes |
124 // the retransmittable frames associated with the packet. | 124 // it from unacked packets if it's not pending. |
125 // Does not remove any previous or subsequent transmissions of this packet. | 125 // Does not remove any previous or subsequent transmissions of this packet. |
126 void RemovePacket(QuicPacketSequenceNumber sequence_number); | 126 void NeuterIfPendingOrRemovePacket(QuicPacketSequenceNumber sequence_number); |
127 | |
128 // Neuters the specified packet. Deletes any retransmittable | |
129 // frames, and sets all_transmissions to only include itself. | |
130 void NeuterPacket(QuicPacketSequenceNumber sequence_number); | |
131 | 127 |
132 // Returns true if the packet has been marked as sent by SetSent. | 128 // Returns true if the packet has been marked as sent by SetSent. |
133 static bool IsSentAndNotPending(const TransmissionInfo& transmission_info); | 129 static bool IsSentAndNotPending(const TransmissionInfo& transmission_info); |
134 | 130 |
135 private: | 131 private: |
136 QuicPacketSequenceNumber largest_sent_packet_; | 132 QuicPacketSequenceNumber largest_sent_packet_; |
137 | 133 |
138 // Newly serialized retransmittable and fec packets are added to this map, | 134 // Newly serialized retransmittable and fec packets are added to this map, |
139 // which contains owning pointers to any contained frames. If a packet is | 135 // 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 | 136 // 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 | 137 // packet. The old packet's retransmittable frames entry will be NULL, while |
142 // the new packet's entry will contain the frames to retransmit. | 138 // 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 | 139 // 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 | 140 // be removed from the map and the new entry's retransmittable frames will be |
145 // set to NULL. | 141 // set to NULL. |
146 UnackedPacketMap unacked_packets_; | 142 UnackedPacketMap unacked_packets_; |
147 | 143 |
148 size_t bytes_in_flight_; | 144 size_t bytes_in_flight_; |
149 // Number of outstanding crypto handshake packets. | 145 // Number of outstanding crypto handshake packets. |
150 size_t pending_crypto_packet_count_; | 146 size_t pending_crypto_packet_count_; |
151 | 147 |
152 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap); | 148 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap); |
153 }; | 149 }; |
154 | 150 |
155 } // namespace net | 151 } // namespace net |
156 | 152 |
157 #endif // NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ | 153 #endif // NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ |
OLD | NEW |