In quic, consider frame expansion when extra padding is needed to meet the minimum plaintext size needed for header protection. protected by gfe2_reloadable_flag_quic_fix_extra_padding_bytes.

PiperOrigin-RevId: 318497490
Change-Id: If5ade70a1992e6daa7c6d116cb778cb88210981c
diff --git a/quic/core/quic_packet_creator.h b/quic/core/quic_packet_creator.h
index ddc5e2d..c579e42 100644
--- a/quic/core/quic_packet_creator.h
+++ b/quic/core/quic_packet_creator.h
@@ -542,6 +542,14 @@
   // Returns true if packet under construction has IETF long header.
   bool HasIetfLongHeader() const;
 
+  // Get serialized frame length. Returns 0 if the frame does not fit into
+  // current packet.
+  size_t GetSerializedFrameLength(const QuicFrame& frame);
+
+  // Add extra padding to pending_padding_bytes_ to meet minimum plaintext
+  // packet size required for header protection.
+  void MaybeAddExtraPaddingForHeaderProtection();
+
   // Does not own these delegates or the framer.
   DelegateInterface* delegate_;
   DebugDelegate* debug_delegate_;
@@ -622,7 +630,11 @@
   // When true, this will override the padding generation code to disable it.
   bool disable_padding_override_ = false;
 
-  bool update_packet_size_ = GetQuicReloadableFlag(quic_update_packet_size);
+  const bool update_packet_size_ =
+      GetQuicReloadableFlag(quic_update_packet_size);
+
+  const bool fix_extra_padding_bytes_ =
+      GetQuicReloadableFlag(quic_fix_extra_padding_bytes);
 };
 
 }  // namespace quic