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 28 matching lines...) Expand all Loading... |
39 // Zero when the packet is serialized, non-zero once it's sent. | 39 // Zero when the packet is serialized, non-zero once it's sent. |
40 QuicByteCount bytes_sent; | 40 QuicByteCount bytes_sent; |
41 size_t nack_count; | 41 size_t nack_count; |
42 // Stores the sequence numbers of all transmissions of this packet. | 42 // Stores the sequence numbers of all transmissions of this packet. |
43 // Can never be null. | 43 // Can never be null. |
44 SequenceNumberSet* all_transmissions; | 44 SequenceNumberSet* all_transmissions; |
45 // Pending packets have not been abandoned or lost. | 45 // Pending packets have not been abandoned or lost. |
46 bool pending; | 46 bool pending; |
47 }; | 47 }; |
48 | 48 |
49 explicit QuicUnackedPacketMap(bool is_server); | 49 QuicUnackedPacketMap(); |
50 ~QuicUnackedPacketMap(); | 50 ~QuicUnackedPacketMap(); |
51 | 51 |
52 // Adds |serialized_packet| to the map. Does not mark it pending. | 52 // Adds |serialized_packet| to the map. Does not mark it pending. |
53 void AddPacket(const SerializedPacket& serialized_packet); | 53 void AddPacket(const SerializedPacket& serialized_packet); |
54 | 54 |
55 // Called when a packet is retransmitted with a new sequence number. | 55 // Called when a packet is retransmitted with a new sequence number. |
56 // |old_sequence_number| will remain unacked, but will have no | 56 // |old_sequence_number| will remain unacked, but will have no |
57 // retransmittable data associated with it. |new_sequence_number| will | 57 // retransmittable data associated with it. |new_sequence_number| will |
58 // be both unacked and associated with retransmittable data. | 58 // be both unacked and associated with retransmittable data. |
59 void OnRetransmittedPacket(QuicPacketSequenceNumber old_sequence_number, | 59 void OnRetransmittedPacket(QuicPacketSequenceNumber old_sequence_number, |
(...skipping 22 matching lines...) Expand all Loading... |
82 // Returns true if there are any unacked packets. | 82 // Returns true if there are any unacked packets. |
83 bool HasUnackedPackets() const; | 83 bool HasUnackedPackets() const; |
84 | 84 |
85 // Returns true if there are any unacked packets which have retransmittable | 85 // Returns true if there are any unacked packets which have retransmittable |
86 // frames. | 86 // frames. |
87 bool HasUnackedRetransmittableFrames() const; | 87 bool HasUnackedRetransmittableFrames() const; |
88 | 88 |
89 // Returns the number of unacked packets which have retransmittable frames. | 89 // Returns the number of unacked packets which have retransmittable frames. |
90 size_t GetNumRetransmittablePackets() const; | 90 size_t GetNumRetransmittablePackets() const; |
91 | 91 |
92 // Returns the total number of bytes associated with pending packets. | |
93 size_t bytes_in_flight() const { | |
94 return bytes_in_flight_; | |
95 } | |
96 | |
97 // Returns the largest sequence number that has been sent. | 92 // Returns the largest sequence number that has been sent. |
98 QuicPacketSequenceNumber largest_sent_packet() const { | 93 QuicPacketSequenceNumber largest_sent_packet() const { |
99 return largest_sent_packet_; | 94 return largest_sent_packet_; |
100 } | 95 } |
101 | 96 |
102 // Returns the smallest sequence number of a serialized packet which has not | 97 // Returns the smallest sequence number of a serialized packet which has not |
103 // been acked by the peer. If there are no unacked packets, returns 0. | 98 // been acked by the peer. If there are no unacked packets, returns 0. |
104 QuicPacketSequenceNumber GetLeastUnackedSentPacket() const; | 99 QuicPacketSequenceNumber GetLeastUnackedSentPacket() const; |
105 | 100 |
106 // Returns the set of sequence numbers of all unacked packets. | 101 // Returns the set of sequence numbers of all unacked packets. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // retransmitted, this map will contain entries for both the old and the new | 156 // retransmitted, this map will contain entries for both the old and the new |
162 // packet. The old packet's retransmittable frames entry will be NULL, while | 157 // packet. The old packet's retransmittable frames entry will be NULL, while |
163 // the new packet's entry will contain the frames to retransmit. | 158 // the new packet's entry will contain the frames to retransmit. |
164 // If the old packet is acked before the new packet, then the old entry will | 159 // If the old packet is acked before the new packet, then the old entry will |
165 // be removed from the map and the new entry's retransmittable frames will be | 160 // be removed from the map and the new entry's retransmittable frames will be |
166 // set to NULL. | 161 // set to NULL. |
167 UnackedPacketMap unacked_packets_; | 162 UnackedPacketMap unacked_packets_; |
168 | 163 |
169 size_t bytes_in_flight_; | 164 size_t bytes_in_flight_; |
170 | 165 |
171 bool is_server_; | |
172 | |
173 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap); | 166 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap); |
174 }; | 167 }; |
175 | 168 |
176 } // namespace net | 169 } // namespace net |
177 | 170 |
178 #endif // NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ | 171 #endif // NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ |
OLD | NEW |