Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(580)

Unified Diff: net/quic/quic_ack_notifier_manager.cc

Issue 872403007: Remove an unneeded hash_set from QuicAckNotifierManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Minor_cleanup_84624803
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_ack_notifier_manager.h ('k') | net/quic/quic_ack_notifier_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_ack_notifier_manager.cc
diff --git a/net/quic/quic_ack_notifier_manager.cc b/net/quic/quic_ack_notifier_manager.cc
index 613ba4c01ab3739a10fb990ab03646df9bd53ac6..357c5469133e19d50abc9fe4133a159143c3609a 100644
--- a/net/quic/quic_ack_notifier_manager.cc
+++ b/net/quic/quic_ack_notifier_manager.cc
@@ -20,7 +20,13 @@ namespace net {
AckNotifierManager::AckNotifierManager() {}
AckNotifierManager::~AckNotifierManager() {
- STLDeleteElements(&ack_notifiers_);
+ for (const auto& pair : ack_notifier_map_) {
+ for (QuicAckNotifier* notifier : pair.second) {
+ if (notifier->OnPacketAbandoned()) {
+ delete notifier;
+ }
+ }
+ }
}
void AckNotifierManager::OnPacketAcked(QuicPacketSequenceNumber sequence_number,
@@ -39,9 +45,8 @@ void AckNotifierManager::OnPacketAcked(QuicPacketSequenceNumber sequence_number,
ack_notifier->OnAck(sequence_number, delta_largest_observed);
// If this has resulted in an empty AckNotifer, erase it.
- if (ack_notifier->IsEmpty()) {
+ if (!ack_notifier->HasUnackedPackets()) {
delete ack_notifier;
- ack_notifiers_.erase(ack_notifier);
}
}
@@ -86,9 +91,6 @@ void AckNotifierManager::OnSerializedPacket(
// Update the mapping in the other direction, from sequence number to
// AckNotifier.
ack_notifier_map_[serialized_packet.sequence_number].push_back(notifier);
-
- // Take ownership of the AckNotifier.
- ack_notifiers_.insert(notifier);
}
} else {
// AckNotifiers can only be attached to retransmittable frames.
@@ -111,9 +113,6 @@ void AckNotifierManager::OnSerializedPacket(
// Update the mapping in the other direction, from sequence number to
// AckNotifier.
ack_notifier_map_[serialized_packet.sequence_number].push_back(notifier);
-
- // Take ownership of the AckNotifier.
- ack_notifiers_.insert(notifier);
}
}
}
« no previous file with comments | « net/quic/quic_ack_notifier_manager.h ('k') | net/quic/quic_ack_notifier_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698