Notify quicconnectionvisitorinterface when forward progress is made after path degrading.

No flag protection, no-op in the shared code. Chromium QuicChromiumClientSession will override OnForwardProgressMadeAfterPathDegrading to handle differently.

PiperOrigin-RevId: 315999536
Change-Id: Ibc7ac1ca4c8a38cba29b67f5bd366b29d9d85df3
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index 7b59c2f..abd0f22 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -4359,7 +4359,10 @@
 }
 
 void QuicConnection::OnForwardProgressMade() {
-  is_path_degrading_ = false;
+  if (is_path_degrading_) {
+    visitor_->OnForwardProgressMadeAfterPathDegrading();
+    is_path_degrading_ = false;
+  }
   if (sent_packet_manager_.HasInFlightPackets()) {
     // Restart detections if forward progress has been made.
     blackhole_detector_.RestartDetection(GetPathDegradingDeadline(),
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h
index 5683c8b..d43093c 100644
--- a/quic/core/quic_connection.h
+++ b/quic/core/quic_connection.h
@@ -146,6 +146,9 @@
   // Called when the peer seems unreachable over the current path.
   virtual void OnPathDegrading() = 0;
 
+  // Called when forward progress made after path degrading.
+  virtual void OnForwardProgressMadeAfterPathDegrading() = 0;
+
   // Called when the connection sends ack after
   // max_consecutive_num_packets_with_no_retransmittable_frames_ consecutive not
   // retransmittable packets sent. To instigate an ack from peer, a
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index 25f9abd..a245316 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -8204,6 +8204,7 @@
   // degrading. And will set a timer to detect new path degrading.
   clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(5));
   EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _, _));
+  EXPECT_CALL(visitor_, OnForwardProgressMadeAfterPathDegrading()).Times(1);
   frame = InitAckFrame({{QuicPacketNumber(2), QuicPacketNumber(3)}});
   ProcessAckPacket(&frame);
   EXPECT_FALSE(connection_.IsPathDegrading());
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc
index dcf4962..5043f1f 100644
--- a/quic/core/quic_session.cc
+++ b/quic/core/quic_session.cc
@@ -438,6 +438,8 @@
 
 void QuicSession::OnPathDegrading() {}
 
+void QuicSession::OnForwardProgressMadeAfterPathDegrading() {}
+
 bool QuicSession::AllowSelfAddressChange() const {
   return false;
 }
diff --git a/quic/core/quic_session.h b/quic/core/quic_session.h
index 09b3c17..e1e5188 100644
--- a/quic/core/quic_session.h
+++ b/quic/core/quic_session.h
@@ -122,6 +122,7 @@
   void SendPing() override;
   bool WillingAndAbleToWrite() const override;
   void OnPathDegrading() override;
+  void OnForwardProgressMadeAfterPathDegrading() override;
   bool AllowSelfAddressChange() const override;
   HandshakeState GetHandshakeState() const override;
   bool OnMaxStreamsFrame(const QuicMaxStreamsFrame& frame) override;
diff --git a/quic/test_tools/quic_test_utils.h b/quic/test_tools/quic_test_utils.h
index 26bd95e..839bb56 100644
--- a/quic/test_tools/quic_test_utils.h
+++ b/quic/test_tools/quic_test_utils.h
@@ -509,6 +509,7 @@
               (AddressChangeType type),
               (override));
   MOCK_METHOD(void, OnPathDegrading, (), (override));
+  MOCK_METHOD(void, OnForwardProgressMadeAfterPathDegrading, (), (override));
   MOCK_METHOD(bool, WillingAndAbleToWrite, (), (const, override));
   MOCK_METHOD(bool, ShouldKeepConnectionAlive, (), (const, override));
   MOCK_METHOD(void,
diff --git a/quic/test_tools/simulator/quic_endpoint.h b/quic/test_tools/simulator/quic_endpoint.h
index 3d0c04d..cb3c386 100644
--- a/quic/test_tools/simulator/quic_endpoint.h
+++ b/quic/test_tools/simulator/quic_endpoint.h
@@ -76,6 +76,7 @@
   void OnCongestionWindowChange(QuicTime /*now*/) override {}
   void OnConnectionMigration(AddressChangeType /*type*/) override {}
   void OnPathDegrading() override {}
+  void OnForwardProgressMadeAfterPathDegrading() override {}
   void OnAckNeedsRetransmittableFrame() override {}
   void SendPing() override {}
   bool AllowSelfAddressChange() const override;