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

Unified Diff: net/quic/quic_ack_notifier_manager.cc

Issue 25443002: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
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 76515bacbb45e53983135cee24c163f588533fba..901d9d67045d7d5f865a922c717e4fa02863771c 100644
--- a/net/quic/quic_ack_notifier_manager.cc
+++ b/net/quic/quic_ack_notifier_manager.cc
@@ -7,7 +7,6 @@
#include <stddef.h>
#include <list>
#include <map>
-#include <set>
#include <utility>
#include <vector>
@@ -46,13 +45,13 @@ void AckNotifierManager::OnIncomingAck(const SequenceNumberSet& acked_packets) {
}
// Clear up any empty AckNotifiers
- AckNotifierList::iterator it = ack_notifiers_.begin();
+ AckNotifierSet::iterator it = ack_notifiers_.begin();
while (it != ack_notifiers_.end()) {
if ((*it)->IsEmpty()) {
// The QuicAckNotifier has seen all the ACKs it was interested in, and
// has triggered its callback. No more use for it.
delete *it;
- it = ack_notifiers_.erase(it);
+ ack_notifiers_.erase(it++);
} else {
++it;
}
@@ -84,29 +83,31 @@ void AckNotifierManager::OnSerializedPacket(
// Run through all the frames and if any of them are stream frames and have
// an AckNotifier registered, then inform the AckNotifier that it should be
// interested in this packet's sequence number.
- RetransmittableFrames* retransmittable_frames =
- serialized_packet.retransmittable_frames;
- if (retransmittable_frames) {
- for (QuicFrames::const_iterator it =
- retransmittable_frames->frames().begin();
- it != retransmittable_frames->frames().end(); ++it) {
- if (it->type == STREAM_FRAME && it->stream_frame->notifier != NULL) {
- // The AckNotifier needs to know it is tracking this packet's sequence
- // number.
- it->stream_frame->notifier->AddSequenceNumber(
- serialized_packet.sequence_number);
-
- // Update the mapping in the other direction, from sequence
- // number to AckNotifier.
- ack_notifier_map_[serialized_packet.sequence_number]
- .insert(it->stream_frame->notifier);
- }
- }
+
+ RetransmittableFrames* frames = serialized_packet.retransmittable_frames;
+
+ // AckNotifiers can only be attached to retransmittable frames.
+ if (!frames) {
+ return;
}
-}
-void AckNotifierManager::AddAckNotifier(QuicAckNotifier* notifier) {
- ack_notifiers_.push_back(notifier);
+ for (QuicFrames::const_iterator it = frames->frames().begin();
+ it != frames->frames().end(); ++it) {
+ if (it->type == STREAM_FRAME && it->stream_frame->notifier != NULL) {
+ // The AckNotifier needs to know it is tracking this packet's sequence
+ // number.
+ it->stream_frame->notifier->AddSequenceNumber(
+ serialized_packet.sequence_number);
+
+ // Add the AckNotifier to our set of AckNotifiers.
+ ack_notifiers_.insert(it->stream_frame->notifier);
+
+ // Update the mapping in the other direction, from sequence
+ // number to AckNotifier.
+ ack_notifier_map_[serialized_packet.sequence_number]
+ .insert(it->stream_frame->notifier);
+ }
+ }
}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698