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 #include "net/quic/quic_ack_notifier_manager.h" | 5 #include "net/quic/quic_ack_notifier_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
14 #include "net/quic/quic_ack_notifier.h" | 14 #include "net/quic/quic_ack_notifier.h" |
15 #include "net/quic/quic_protocol.h" | 15 #include "net/quic/quic_protocol.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 AckNotifierManager::AckNotifierManager() {} | 19 AckNotifierManager::AckNotifierManager() {} |
20 | 20 |
21 AckNotifierManager::~AckNotifierManager() { | 21 AckNotifierManager::~AckNotifierManager() { |
22 STLDeleteElements(&ack_notifiers_); | 22 STLDeleteElements(&ack_notifiers_); |
23 } | 23 } |
24 | 24 |
25 void AckNotifierManager::OnPacketAcked( | 25 void AckNotifierManager::OnPacketAcked( |
26 QuicPacketSequenceNumber sequence_number) { | 26 QuicPacketSequenceNumber sequence_number, |
| 27 QuicTime::Delta delta_largest_observed) { |
27 // Inform all the registered AckNotifiers of the new ACK. | 28 // Inform all the registered AckNotifiers of the new ACK. |
28 AckNotifierMap::iterator map_it = ack_notifier_map_.find(sequence_number); | 29 AckNotifierMap::iterator map_it = ack_notifier_map_.find(sequence_number); |
29 if (map_it == ack_notifier_map_.end()) { | 30 if (map_it == ack_notifier_map_.end()) { |
30 // No AckNotifier is interested in this sequence number. | 31 // No AckNotifier is interested in this sequence number. |
31 return; | 32 return; |
32 } | 33 } |
33 | 34 |
34 // One or more AckNotifiers are registered as interested in this sequence | 35 // One or more AckNotifiers are registered as interested in this sequence |
35 // number. Iterate through them and call OnAck on each. | 36 // number. Iterate through them and call OnAck on each. |
36 for (AckNotifierSet::iterator set_it = map_it->second.begin(); | 37 for (AckNotifierSet::iterator set_it = map_it->second.begin(); |
37 set_it != map_it->second.end(); ++set_it) { | 38 set_it != map_it->second.end(); ++set_it) { |
38 QuicAckNotifier* ack_notifier = *set_it; | 39 QuicAckNotifier* ack_notifier = *set_it; |
39 ack_notifier->OnAck(sequence_number); | 40 ack_notifier->OnAck(sequence_number, delta_largest_observed); |
40 | 41 |
41 // If this has resulted in an empty AckNotifer, erase it. | 42 // If this has resulted in an empty AckNotifer, erase it. |
42 if (ack_notifier->IsEmpty()) { | 43 if (ack_notifier->IsEmpty()) { |
43 delete ack_notifier; | 44 delete ack_notifier; |
44 ack_notifiers_.erase(ack_notifier); | 45 ack_notifiers_.erase(ack_notifier); |
45 } | 46 } |
46 } | 47 } |
47 | 48 |
48 // Remove the sequence number from the map as we have notified all the | 49 // Remove the sequence number from the map as we have notified all the |
49 // registered AckNotifiers, and we won't see it again. | 50 // registered AckNotifiers, and we won't see it again. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // number to AckNotifier. | 98 // number to AckNotifier. |
98 ack_notifier_map_[serialized_packet.sequence_number].insert(notifier); | 99 ack_notifier_map_[serialized_packet.sequence_number].insert(notifier); |
99 | 100 |
100 // Take ownership of the AckNotifier. | 101 // Take ownership of the AckNotifier. |
101 ack_notifiers_.insert(notifier); | 102 ack_notifiers_.insert(notifier); |
102 } | 103 } |
103 } | 104 } |
104 } | 105 } |
105 | 106 |
106 } // namespace net | 107 } // namespace net |
OLD | NEW |