Add a OnCoalescedPacketSent to QuicConnectionDebugVisitor. This will used for net-log in chromium.
gfe-relnote: n/a (debug only change)
PiperOrigin-RevId: 301652636
Change-Id: Ib899939a4def1555e04d561fcddbbf419f3efd03
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index daf5031..31a5eb2 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -3941,6 +3941,9 @@
buffered_packets_.emplace_back(buffer, length,
coalesced_packet_.self_address(),
coalesced_packet_.peer_address());
+ if (debug_visitor_ != nullptr) {
+ debug_visitor_->OnCoalescedPacketSent(coalesced_packet_, length);
+ }
return true;
}
@@ -3961,6 +3964,9 @@
coalesced_packet_.peer_address());
}
}
+ if (debug_visitor_ != nullptr) {
+ debug_visitor_->OnCoalescedPacketSent(coalesced_packet_, length);
+ }
// Account for added padding.
if (length > coalesced_packet_.length()) {
size_t padding_size = length - coalesced_packet_.length();
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h
index f35aa05..e92c876 100644
--- a/quic/core/quic_connection.h
+++ b/quic/core/quic_connection.h
@@ -194,6 +194,11 @@
TransmissionType /*transmission_type*/,
QuicTime /*sent_time*/) {}
+ // Called when a coalesced packet has been sent.
+ virtual void OnCoalescedPacketSent(
+ const QuicCoalescedPacket& /*coalesced_packet*/,
+ size_t /*length*/) {}
+
// Called when a PING frame has been sent.
virtual void OnPingSent() {}
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index cb2583e..98c2d57 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -9902,6 +9902,10 @@
if (!connection_.version().CanSendCoalescedPackets()) {
return;
}
+ MockQuicConnectionDebugVisitor debug_visitor;
+ connection_.set_debug_visitor(&debug_visitor);
+ EXPECT_CALL(debug_visitor, OnPacketSent(_, _, _)).Times(3);
+ EXPECT_CALL(debug_visitor, OnCoalescedPacketSent(_, _)).Times(1);
{
QuicConnection::ScopedPacketFlusher flusher(&connection_);
use_tagging_decrypter();