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; | |
52 // TODO(ianswett): Further improvement may come from changing this to a deque. | 51 // TODO(ianswett): Further improvement may come from changing this to a deque. |
53 typedef base::hash_map<QuicPacketSequenceNumber, AckNotifierList> | 52 typedef base::hash_map<QuicPacketSequenceNumber, AckNotifierList> |
54 AckNotifierMap; | 53 AckNotifierMap; |
55 | 54 |
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 | |
63 // Maps from sequence number to the AckNotifiers which are registered | 55 // Maps from sequence number to the AckNotifiers which are registered |
64 // for that sequence number. On receipt of an ACK for a given sequence | 56 // for that sequence number. On receipt of an ACK for a given sequence |
65 // number, call OnAck for all mapped AckNotifiers. | 57 // number, call OnAck for all mapped AckNotifiers. |
66 // Does not own the AckNotifiers. | 58 // When the last reference is removed from the map, the notifier is deleted. |
67 AckNotifierMap ack_notifier_map_; | 59 AckNotifierMap ack_notifier_map_; |
68 | 60 |
69 DISALLOW_COPY_AND_ASSIGN(AckNotifierManager); | 61 DISALLOW_COPY_AND_ASSIGN(AckNotifierManager); |
70 }; | 62 }; |
71 | 63 |
72 } // namespace net | 64 } // namespace net |
73 | 65 |
74 #endif // NET_QUIC_QUIC_ACK_NOTIFIER_MANAGER_H_ | 66 #endif // NET_QUIC_QUIC_ACK_NOTIFIER_MANAGER_H_ |
OLD | NEW |