Make QuicControlFrameManager talk to QuicSession via a delegate.

This makes the ownership clear and prevents the control frame manager from unnecessarily accessing the session.

Refactor only. not protected.

PiperOrigin-RevId: 321460931
Change-Id: Iff7f35f9626a46f6afe37f9a02c8ff653aa9437e
diff --git a/quic/core/quic_control_frame_manager.h b/quic/core/quic_control_frame_manager.h
index ffd378c..7615754 100644
--- a/quic/core/quic_control_frame_manager.h
+++ b/quic/core/quic_control_frame_manager.h
@@ -30,6 +30,18 @@
 // which need to be retransmitted.
 class QUIC_EXPORT_PRIVATE QuicControlFrameManager {
  public:
+  class QUIC_EXPORT_PRIVATE DelegateInterface {
+   public:
+    virtual ~DelegateInterface() = default;
+
+    // Notifies the delegate of errors.
+    virtual void OnControlFrameManagerError(QuicErrorCode error_code,
+                                            std::string error_details) = 0;
+
+    virtual bool WriteControlFrame(const QuicFrame& frame,
+                                   TransmissionType type) = 0;
+  };
+
   explicit QuicControlFrameManager(QuicSession* session);
   QuicControlFrameManager(const QuicControlFrameManager& other) = delete;
   QuicControlFrameManager(QuicControlFrameManager&& other) = delete;
@@ -146,8 +158,7 @@
   // Lost control frames waiting to be retransmitted.
   QuicLinkedHashMap<QuicControlFrameId, bool> pending_retransmissions_;
 
-  // Pointer to the owning QuicSession object.
-  QuicSession* session_;
+  DelegateInterface* delegate_;
 
   // Last sent window update frame for each stream.
   QuicSmallMap<QuicStreamId, QuicControlFrameId, 10> window_update_frames_;