| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // had any retransmittable packets in the first place. | 45 // had any retransmittable packets in the first place. |
| 46 bool HasRetransmittableFrames(QuicPacketSequenceNumber sequence_number) const; | 46 bool HasRetransmittableFrames(QuicPacketSequenceNumber sequence_number) const; |
| 47 | 47 |
| 48 // Returns true if there are any unacked packets. | 48 // Returns true if there are any unacked packets. |
| 49 bool HasUnackedPackets() const; | 49 bool HasUnackedPackets() const; |
| 50 | 50 |
| 51 // Returns true if there are any unacked packets which have retransmittable | 51 // Returns true if there are any unacked packets which have retransmittable |
| 52 // frames. | 52 // frames. |
| 53 bool HasUnackedRetransmittableFrames() const; | 53 bool HasUnackedRetransmittableFrames() const; |
| 54 | 54 |
| 55 // Returns the number of unacked packets which have retransmittable frames. | |
| 56 size_t GetNumRetransmittablePackets() const; | |
| 57 | |
| 58 // Returns the largest sequence number that has been sent. | 55 // Returns the largest sequence number that has been sent. |
| 59 QuicPacketSequenceNumber largest_sent_packet() const { | 56 QuicPacketSequenceNumber largest_sent_packet() const { |
| 60 return largest_sent_packet_; | 57 return largest_sent_packet_; |
| 61 } | 58 } |
| 62 | 59 |
| 63 // Returns the sum of the bytes in all pending packets. | 60 // Returns the sum of the bytes in all pending packets. |
| 64 QuicByteCount bytes_in_flight() const { | 61 QuicByteCount bytes_in_flight() const { |
| 65 return bytes_in_flight_; | 62 return bytes_in_flight_; |
| 66 } | 63 } |
| 67 | 64 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 112 |
| 116 // Removes entries from the unacked packet map, and deletes | 113 // Removes entries from the unacked packet map, and deletes |
| 117 // the retransmittable frames associated with the packet. | 114 // the retransmittable frames associated with the packet. |
| 118 // Does not remove any previous or subsequent transmissions of this packet. | 115 // Does not remove any previous or subsequent transmissions of this packet. |
| 119 void RemovePacket(QuicPacketSequenceNumber sequence_number); | 116 void RemovePacket(QuicPacketSequenceNumber sequence_number); |
| 120 | 117 |
| 121 // Neuters the specified packet. Deletes any retransmittable | 118 // Neuters the specified packet. Deletes any retransmittable |
| 122 // frames, and sets all_transmissions to only include itself. | 119 // frames, and sets all_transmissions to only include itself. |
| 123 void NeuterPacket(QuicPacketSequenceNumber sequence_number); | 120 void NeuterPacket(QuicPacketSequenceNumber sequence_number); |
| 124 | 121 |
| 125 // Returns true if the packet has been marked as sent by SetSent. | 122 // Returns true if the packet's only purpose is to measure RTT. It must not |
| 126 static bool IsSentAndNotPending(const TransmissionInfo& transmission_info); | 123 // be pending, have retransmittable frames, or be linked to transmissions |
| 124 // with retransmittable frames. |
| 125 static bool IsForRttOnly(const TransmissionInfo& transmission_info); |
| 127 | 126 |
| 128 private: | 127 private: |
| 129 void MaybeRemoveRetransmittableFrames(TransmissionInfo* transmission_info); | 128 void MaybeRemoveRetransmittableFrames(TransmissionInfo* transmission_info); |
| 130 | 129 |
| 131 QuicPacketSequenceNumber largest_sent_packet_; | 130 QuicPacketSequenceNumber largest_sent_packet_; |
| 132 | 131 |
| 133 // Newly serialized retransmittable and fec packets are added to this map, | 132 // Newly serialized retransmittable and fec packets are added to this map, |
| 134 // 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 |
| 135 // 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 |
| 136 // 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 |
| 137 // the new packet's entry will contain the frames to retransmit. | 136 // the new packet's entry will contain the frames to retransmit. |
| 138 // 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 |
| 139 // 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 |
| 140 // set to NULL. | 139 // set to NULL. |
| 141 UnackedPacketMap unacked_packets_; | 140 UnackedPacketMap unacked_packets_; |
| 142 | 141 |
| 143 size_t bytes_in_flight_; | 142 size_t bytes_in_flight_; |
| 144 // Number of outstanding crypto handshake packets. | 143 // Number of outstanding crypto handshake packets. |
| 145 size_t pending_crypto_packet_count_; | 144 size_t pending_crypto_packet_count_; |
| 146 | 145 |
| 147 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap); | 146 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap); |
| 148 }; | 147 }; |
| 149 | 148 |
| 150 } // namespace net | 149 } // namespace net |
| 151 | 150 |
| 152 #endif // NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ | 151 #endif // NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ |
| OLD | NEW |