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