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 <map> | 9 #include <map> |
9 | 10 |
10 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
11 #include "net/quic/quic_protocol.h" | 12 #include "net/quic/quic_protocol.h" |
12 | 13 |
13 namespace net { | 14 namespace net { |
14 | 15 |
15 class QuicAckNotifier; | 16 class QuicAckNotifier; |
16 | 17 |
17 // The AckNotifierManager is used by the QuicSentPacketManager to keep track of | 18 // The AckNotifierManager is used by the QuicSentPacketManager to keep track of |
(...skipping 20 matching lines...) Expand all Loading... |
38 QuicPacketSequenceNumber new_sequence_number); | 39 QuicPacketSequenceNumber new_sequence_number); |
39 | 40 |
40 // This is called after a packet has been serialized, is ready to be sent, and | 41 // This is called after a packet has been serialized, is ready to be sent, and |
41 // contains retransmittable frames (which may have associated AckNotifiers). | 42 // contains retransmittable frames (which may have associated AckNotifiers). |
42 // If any of the retransmittable frames included in |serialized_packet| have | 43 // If any of the retransmittable frames included in |serialized_packet| have |
43 // AckNotifiers registered, then add them to our internal map and additionally | 44 // AckNotifiers registered, then add them to our internal map and additionally |
44 // inform the AckNotifier of the sequence number which it should track. | 45 // inform the AckNotifier of the sequence number which it should track. |
45 void OnSerializedPacket(const SerializedPacket& serialized_packet); | 46 void OnSerializedPacket(const SerializedPacket& serialized_packet); |
46 | 47 |
47 private: | 48 private: |
| 49 typedef std::list<QuicAckNotifier*> AckNotifierList; |
48 typedef base::hash_set<QuicAckNotifier*> AckNotifierSet; | 50 typedef base::hash_set<QuicAckNotifier*> AckNotifierSet; |
49 typedef std::map<QuicPacketSequenceNumber, AckNotifierSet> AckNotifierMap; | 51 // TODO(ianswett): Further improvement may come from changing this to a deque. |
| 52 typedef base::hash_map<QuicPacketSequenceNumber, AckNotifierList> |
| 53 AckNotifierMap; |
50 | 54 |
51 // On every ACK frame received by the connection, all the ack_notifiers_ will | 55 // On every ACK frame received by the connection, all the ack_notifiers_ will |
52 // be told which sequeunce numbers were ACKed. | 56 // be told which sequeunce numbers were ACKed. |
53 // Once a given QuicAckNotifier has seen all the sequence numbers it is | 57 // Once a given QuicAckNotifier has seen all the sequence numbers it is |
54 // interested in, it will be deleted, and removed from this set. | 58 // interested in, it will be deleted, and removed from this set. |
55 // Owns the AckNotifiers in this set. | 59 // Owns the AckNotifiers in this set. |
56 AckNotifierSet ack_notifiers_; | 60 AckNotifierSet ack_notifiers_; |
57 | 61 |
58 // Maps from sequence number to the AckNotifiers which are registered | 62 // Maps from sequence number to the AckNotifiers which are registered |
59 // for that sequence number. On receipt of an ACK for a given sequence | 63 // for that sequence number. On receipt of an ACK for a given sequence |
60 // number, call OnAck for all mapped AckNotifiers. | 64 // number, call OnAck for all mapped AckNotifiers. |
61 // Does not own the AckNotifiers. | 65 // Does not own the AckNotifiers. |
62 AckNotifierMap ack_notifier_map_; | 66 AckNotifierMap ack_notifier_map_; |
63 | 67 |
64 DISALLOW_COPY_AND_ASSIGN(AckNotifierManager); | 68 DISALLOW_COPY_AND_ASSIGN(AckNotifierManager); |
65 }; | 69 }; |
66 | 70 |
67 } // namespace net | 71 } // namespace net |
68 | 72 |
69 #endif // NET_QUIC_QUIC_ACK_NOTIFIER_MANAGER_H_ | 73 #endif // NET_QUIC_QUIC_ACK_NOTIFIER_MANAGER_H_ |
OLD | NEW |