| 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> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 delete ack_notifier; | 43 delete ack_notifier; |
| 44 ack_notifiers_.erase(ack_notifier); | 44 ack_notifiers_.erase(ack_notifier); |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 | 47 |
| 48 // Remove the sequence number from the map as we have notified all the | 48 // Remove the sequence number from the map as we have notified all the |
| 49 // registered AckNotifiers, and we won't see it again. | 49 // registered AckNotifiers, and we won't see it again. |
| 50 ack_notifier_map_.erase(map_it); | 50 ack_notifier_map_.erase(map_it); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void AckNotifierManager::UpdateSequenceNumber( | 53 void AckNotifierManager::OnPacketRetransmitted( |
| 54 QuicPacketSequenceNumber old_sequence_number, | 54 QuicPacketSequenceNumber old_sequence_number, |
| 55 QuicPacketSequenceNumber new_sequence_number) { | 55 QuicPacketSequenceNumber new_sequence_number, |
| 56 int packet_payload_size) { |
| 56 auto map_it = ack_notifier_map_.find(old_sequence_number); | 57 auto map_it = ack_notifier_map_.find(old_sequence_number); |
| 57 if (map_it == ack_notifier_map_.end()) { | 58 if (map_it == ack_notifier_map_.end()) { |
| 58 // No AckNotifiers are interested in the old sequence number. | 59 // No AckNotifiers are interested in the old sequence number. |
| 59 return; | 60 return; |
| 60 } | 61 } |
| 61 | 62 |
| 62 // Update the existing QuicAckNotifiers to the new sequence number. | 63 // Update the existing QuicAckNotifiers to the new sequence number. |
| 63 AckNotifierList& ack_notifier_list = map_it->second; | 64 AckNotifierList& ack_notifier_list = map_it->second; |
| 64 for (QuicAckNotifier* ack_notifier : ack_notifier_list) { | 65 for (QuicAckNotifier* ack_notifier : ack_notifier_list) { |
| 65 ack_notifier->UpdateSequenceNumber(old_sequence_number, | 66 ack_notifier->OnPacketRetransmitted(packet_payload_size); |
| 66 new_sequence_number); | |
| 67 } | 67 } |
| 68 | 68 |
| 69 // The old sequence number is no longer of interest, copy the updated | 69 // The old sequence number is no longer of interest, copy the updated |
| 70 // AckNotifiers to the new sequence number before deleting the old. | 70 // AckNotifiers to the new sequence number before deleting the old. |
| 71 ack_notifier_map_[new_sequence_number] = ack_notifier_list; | 71 ack_notifier_map_[new_sequence_number] = ack_notifier_list; |
| 72 ack_notifier_map_.erase(map_it); | 72 ack_notifier_map_.erase(map_it); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void AckNotifierManager::OnSerializedPacket( | 75 void AckNotifierManager::OnSerializedPacket( |
| 76 const SerializedPacket& serialized_packet) { | 76 const SerializedPacket& serialized_packet) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // AckNotifier. | 114 // AckNotifier. |
| 115 ack_notifier_map_[serialized_packet.sequence_number].push_back(notifier); | 115 ack_notifier_map_[serialized_packet.sequence_number].push_back(notifier); |
| 116 | 116 |
| 117 // Take ownership of the AckNotifier. | 117 // Take ownership of the AckNotifier. |
| 118 ack_notifiers_.insert(notifier); | 118 ack_notifiers_.insert(notifier); |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace net | 123 } // namespace net |
| OLD | NEW |