gfe-relnote: In BandwidthSampler, capture the number of lost bytes at the time a packet is sent, and make it available to caller when the packet is acked or lost. No behavior change, not protected.
In addition to the number of lost bytes, this CL also makes the number of sent bytes and number of acked bytes available to caller when a packet is acked or lost.
This is needed for BBRv2 to set inflight_hi when loss is high.
PiperOrigin-RevId: 242001670
Change-Id: I90543435eb1052b2afb3942d1b744c8153524461
diff --git a/quic/core/packet_number_indexed_queue.h b/quic/core/packet_number_indexed_queue.h
index ab2e20b..695ff7d 100644
--- a/quic/core/packet_number_indexed_queue.h
+++ b/quic/core/packet_number_indexed_queue.h
@@ -6,6 +6,7 @@
#define QUICHE_QUIC_CORE_PACKET_NUMBER_INDEXED_QUEUE_H_
#include "net/third_party/quiche/src/quic/core/quic_constants.h"
+#include "net/third_party/quiche/src/quic/core/quic_packet_number.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_containers.h"
@@ -54,6 +55,11 @@
// queue as necessary.
bool Remove(QuicPacketNumber packet_number);
+ // Same as above, but if an entry is present in the queue, also call f(entry)
+ // before removing it.
+ template <typename Function>
+ bool Remove(QuicPacketNumber packet_number, Function f);
+
bool IsEmpty() const { return number_of_present_entries_ == 0; }
// Returns the number of entries in the queue.
@@ -161,10 +167,18 @@
template <typename T>
bool PacketNumberIndexedQueue<T>::Remove(QuicPacketNumber packet_number) {
+ return Remove(packet_number, [](const T&) {});
+}
+
+template <typename T>
+template <typename Function>
+bool PacketNumberIndexedQueue<T>::Remove(QuicPacketNumber packet_number,
+ Function f) {
EntryWrapper* entry = GetEntryWrapper(packet_number);
if (entry == nullptr) {
return false;
}
+ f(*static_cast<const T*>(entry));
entry->present = false;
number_of_present_entries_--;