gfe-relnote: Implement BBRv2 for QUIC. Protected by --gfe2_reloadable_flag_quic_default_to_bbr_v2.

PiperOrigin-RevId: 257286231
Change-Id: Ieca742a1bf51290536535fad8e67ad9e3631fe36
diff --git a/quic/core/congestion_control/rtt_stats.cc b/quic/core/congestion_control/rtt_stats.cc
index 06bc60b..f4cbf38 100644
--- a/quic/core/congestion_control/rtt_stats.cc
+++ b/quic/core/congestion_control/rtt_stats.cc
@@ -29,6 +29,7 @@
       mean_deviation_(QuicTime::Delta::Zero()),
       initial_rtt_(QuicTime::Delta::FromMilliseconds(kInitialRttMs)),
       max_ack_delay_(QuicTime::Delta::Zero()),
+      last_update_time_(QuicTime::Zero()),
       ignore_max_ack_delay_(false) {}
 
 void RttStats::ExpireSmoothedMetrics() {
@@ -41,7 +42,7 @@
 // Updates the RTT based on a new sample.
 void RttStats::UpdateRtt(QuicTime::Delta send_delta,
                          QuicTime::Delta ack_delay,
-                         QuicTime /*now*/) {
+                         QuicTime now) {
   if (send_delta.IsInfinite() || send_delta <= QuicTime::Delta::Zero()) {
     QUIC_LOG_FIRST_N(WARNING, 3)
         << "Ignoring measured send_delta, because it's is "
@@ -50,6 +51,8 @@
     return;
   }
 
+  last_update_time_ = now;
+
   // Update min_rtt_ first. min_rtt_ does not use an rtt_sample corrected for
   // ack_delay but the raw observed send_delta, since poor clock granularity at
   // the client may cause a high ack_delay to result in underestimation of the
diff --git a/quic/core/congestion_control/rtt_stats.h b/quic/core/congestion_control/rtt_stats.h
index 65791b1..7b58276 100644
--- a/quic/core/congestion_control/rtt_stats.h
+++ b/quic/core/congestion_control/rtt_stats.h
@@ -75,6 +75,8 @@
 
   QuicTime::Delta max_ack_delay() const { return max_ack_delay_; }
 
+  QuicTime last_update_time() const { return last_update_time_; }
+
   bool ignore_max_ack_delay() const { return ignore_max_ack_delay_; }
 
   void set_ignore_max_ack_delay(bool ignore_max_ack_delay) {
@@ -100,6 +102,7 @@
   // The maximum ack delay observed over the connection after excluding ack
   // delays that were too large to be included in an RTT measurement.
   QuicTime::Delta max_ack_delay_;
+  QuicTime last_update_time_;
   // Whether to ignore the peer's max ack delay.
   bool ignore_max_ack_delay_;
 };
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index ec3e9df..38656b3 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -191,6 +191,18 @@
           header.long_packet_type == RETRY);
 }
 
+CongestionControlType GetDefaultCongestionControlType() {
+  if (GetQuicReloadableFlag(quic_default_to_bbr_v2)) {
+    return kBBRv2;
+  }
+
+  if (GetQuicReloadableFlag(quic_default_to_bbr)) {
+    return kBBR;
+  }
+
+  return kCubicBytes;
+}
+
 }  // namespace
 
 #define ENDPOINT \
@@ -278,13 +290,12 @@
       handshake_timeout_(QuicTime::Delta::Infinite()),
       time_of_first_packet_sent_after_receiving_(QuicTime::Zero()),
       time_of_last_received_packet_(clock_->ApproximateNow()),
-      sent_packet_manager_(
-          perspective,
-          clock_,
-          random_generator_,
-          &stats_,
-          GetQuicReloadableFlag(quic_default_to_bbr) ? kBBR : kCubicBytes,
-          kNack),
+      sent_packet_manager_(perspective,
+                           clock_,
+                           random_generator_,
+                           &stats_,
+                           GetDefaultCongestionControlType(),
+                           kNack),
       version_negotiated_(false),
       perspective_(perspective),
       connected_(true),