Add << operator for TransmissionType to make debugging easier.

No behavior change. not protected.

PiperOrigin-RevId: 314414563
Change-Id: Ia1d4afe900565d6cd9bdcdf39a33cce227a2b5fb
diff --git a/quic/core/quic_packet_creator.cc b/quic/core/quic_packet_creator.cc
index 58d1748..a977a8e 100644
--- a/quic/core/quic_packet_creator.cc
+++ b/quic/core/quic_packet_creator.cc
@@ -1543,7 +1543,7 @@
 bool QuicPacketCreator::AddFrame(const QuicFrame& frame,
                                  TransmissionType transmission_type) {
   QUIC_DVLOG(1) << ENDPOINT << "Adding frame with transmission type "
-                << TransmissionTypeToString(transmission_type) << ": " << frame;
+                << transmission_type << ": " << frame;
   if (frame.type == STREAM_FRAME &&
       !QuicUtils::IsCryptoStreamId(framer_->transport_version(),
                                    frame.stream_frame.stream_id) &&
@@ -1734,8 +1734,7 @@
   bool success = AddFrame(QuicFrame(QuicPaddingFrame(padding_bytes)),
                           packet_.transmission_type);
   QUIC_BUG_IF(!success) << "Failed to add padding_bytes: " << padding_bytes
-                        << " transmission_type: "
-                        << TransmissionTypeToString(packet_.transmission_type);
+                        << " transmission_type: " << packet_.transmission_type;
 }
 
 bool QuicPacketCreator::IncludeNonceInPublicHeader() const {
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc
index 8ab8211..ed0e691 100644
--- a/quic/core/quic_sent_packet_manager.cc
+++ b/quic/core/quic_sent_packet_manager.cc
@@ -567,7 +567,7 @@
   QUIC_BUG_IF(transmission_type != LOSS_RETRANSMISSION &&
               transmission_type != RTO_RETRANSMISSION &&
               !unacked_packets_.HasRetransmittableFrames(*transmission_info))
-      << "transmission_type: " << TransmissionTypeToString(transmission_type);
+      << "transmission_type: " << transmission_type;
   // Handshake packets should never be sent as probing retransmissions.
   DCHECK(!transmission_info->has_crypto_handshake ||
          transmission_type != PROBING_RETRANSMISSION);
@@ -640,8 +640,7 @@
       // Record as a spurious retransmission if this packet is a
       // retransmission and no new data gets acked.
       QUIC_DVLOG(1) << "Detect spurious retransmitted packet " << packet_number
-                    << " transmission type: "
-                    << TransmissionTypeToString(info->transmission_type);
+                    << " transmission type: " << info->transmission_type;
       RecordOneSpuriousRetransmission(*info);
     }
   }
diff --git a/quic/core/quic_types.cc b/quic/core/quic_types.cc
index 72adeed..49ccdf0 100644
--- a/quic/core/quic_types.cc
+++ b/quic/core/quic_types.cc
@@ -190,6 +190,11 @@
   }
 }
 
+std::ostream& operator<<(std::ostream& os, TransmissionType transmission_type) {
+  os << TransmissionTypeToString(transmission_type);
+  return os;
+}
+
 std::string PacketHeaderFormatToString(PacketHeaderFormat format) {
   switch (format) {
     RETURN_STRING_LITERAL(IETF_QUIC_LONG_HEADER_PACKET);
diff --git a/quic/core/quic_types.h b/quic/core/quic_types.h
index 3ab0ba0..753f86e 100644
--- a/quic/core/quic_types.h
+++ b/quic/core/quic_types.h
@@ -177,6 +177,10 @@
 QUIC_EXPORT_PRIVATE std::string TransmissionTypeToString(
     TransmissionType transmission_type);
 
+QUIC_EXPORT_PRIVATE std::ostream& operator<<(
+    std::ostream& os,
+    TransmissionType transmission_type);
+
 enum HasRetransmittableData : uint8_t {
   NO_RETRANSMITTABLE_DATA,
   HAS_RETRANSMITTABLE_DATA,
diff --git a/quic/core/quic_utils.cc b/quic/core/quic_utils.cc
index e4ae863..72d422b 100644
--- a/quic/core/quic_utils.cc
+++ b/quic/core/quic_utils.cc
@@ -351,8 +351,7 @@
     case PROBING_RETRANSMISSION:
       return PROBE_RETRANSMITTED;
     default:
-      QUIC_BUG << TransmissionTypeToString(retransmission_type)
-               << " is not a retransmission_type";
+      QUIC_BUG << retransmission_type << " is not a retransmission_type";
       return UNACKABLE;
   }
 }