OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_ACK_NOTIFIER_MANAGER_H_ | 5 #ifndef NET_QUIC_QUIC_ACK_NOTIFIER_MANAGER_H_ |
6 #define NET_QUIC_QUIC_ACK_NOTIFIER_MANAGER_H_ | 6 #define NET_QUIC_QUIC_ACK_NOTIFIER_MANAGER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 // This is called after a packet has been serialized, is ready to be sent, and | 42 // This is called after a packet has been serialized, is ready to be sent, and |
43 // contains retransmittable frames (which may have associated AckNotifiers). | 43 // contains retransmittable frames (which may have associated AckNotifiers). |
44 // If any of the retransmittable frames included in |serialized_packet| have | 44 // If any of the retransmittable frames included in |serialized_packet| have |
45 // AckNotifiers registered, then add them to our internal map and additionally | 45 // AckNotifiers registered, then add them to our internal map and additionally |
46 // inform the AckNotifier of the sequence number which it should track. | 46 // inform the AckNotifier of the sequence number which it should track. |
47 void OnSerializedPacket(const SerializedPacket& serialized_packet); | 47 void OnSerializedPacket(const SerializedPacket& serialized_packet); |
48 | 48 |
49 private: | 49 private: |
50 typedef std::list<QuicAckNotifier*> AckNotifierList; | 50 typedef std::list<QuicAckNotifier*> AckNotifierList; |
| 51 typedef base::hash_set<QuicAckNotifier*> AckNotifierSet; |
51 // TODO(ianswett): Further improvement may come from changing this to a deque. | 52 // TODO(ianswett): Further improvement may come from changing this to a deque. |
52 typedef base::hash_map<QuicPacketSequenceNumber, AckNotifierList> | 53 typedef base::hash_map<QuicPacketSequenceNumber, AckNotifierList> |
53 AckNotifierMap; | 54 AckNotifierMap; |
54 | 55 |
| 56 // On every ACK frame received by the connection, all the ack_notifiers_ will |
| 57 // be told which sequeunce numbers were ACKed. |
| 58 // Once a given QuicAckNotifier has seen all the sequence numbers it is |
| 59 // interested in, it will be deleted, and removed from this set. |
| 60 // Owns the AckNotifiers in this set. |
| 61 AckNotifierSet ack_notifiers_; |
| 62 |
55 // Maps from sequence number to the AckNotifiers which are registered | 63 // Maps from sequence number to the AckNotifiers which are registered |
56 // for that sequence number. On receipt of an ACK for a given sequence | 64 // for that sequence number. On receipt of an ACK for a given sequence |
57 // number, call OnAck for all mapped AckNotifiers. | 65 // number, call OnAck for all mapped AckNotifiers. |
58 // When the last reference is removed from the map, the notifier is deleted. | 66 // Does not own the AckNotifiers. |
59 AckNotifierMap ack_notifier_map_; | 67 AckNotifierMap ack_notifier_map_; |
60 | 68 |
61 DISALLOW_COPY_AND_ASSIGN(AckNotifierManager); | 69 DISALLOW_COPY_AND_ASSIGN(AckNotifierManager); |
62 }; | 70 }; |
63 | 71 |
64 } // namespace net | 72 } // namespace net |
65 | 73 |
66 #endif // NET_QUIC_QUIC_ACK_NOTIFIER_MANAGER_H_ | 74 #endif // NET_QUIC_QUIC_ACK_NOTIFIER_MANAGER_H_ |
OLD | NEW |