Internal change

PiperOrigin-RevId: 501009036
diff --git a/quiche/quic/core/quic_connection.cc b/quiche/quic/core/quic_connection.cc
index e340897..ef4c9a1 100644
--- a/quiche/quic/core/quic_connection.cc
+++ b/quiche/quic/core/quic_connection.cc
@@ -7054,11 +7054,18 @@
       peer_address_alternative_path_(
           connection_->alternative_path_.peer_address),
       active_effective_peer_migration_type_(
-          connection_->active_effective_peer_migration_type_) {}
+          connection_->active_effective_peer_migration_type_) {
+  if (connection_->count_reverse_path_validation_stats()) {
+    QUIC_CODE_COUNT_N(quic_reverse_path_validation, 1, 4);
+  }
+}
 
 void QuicConnection::ReversePathValidationResultDelegate::
     OnPathValidationSuccess(std::unique_ptr<QuicPathValidationContext> context,
                             QuicTime start_time) {
+  if (connection_->count_reverse_path_validation_stats()) {
+    QUIC_CODE_COUNT_N(quic_reverse_path_validation, 2, 4);
+  }
   QUIC_DLOG(INFO) << "Successfully validated new path " << *context
                   << ", validation started at " << start_time;
   if (connection_->IsDefaultPath(context->self_address(),
@@ -7102,6 +7109,9 @@
 void QuicConnection::ReversePathValidationResultDelegate::
     OnPathValidationFailure(
         std::unique_ptr<QuicPathValidationContext> context) {
+  if (connection_->count_reverse_path_validation_stats()) {
+    QUIC_CODE_COUNT_N(quic_reverse_path_validation, 3, 4);
+  }
   if (!connection_->connected()) {
     return;
   }
diff --git a/quiche/quic/core/quic_connection.h b/quiche/quic/core/quic_connection.h
index 5c06949..b71904d 100644
--- a/quiche/quic/core/quic_connection.h
+++ b/quiche/quic/core/quic_connection.h
@@ -1382,6 +1382,13 @@
     return connection_id_generator_;
   }
 
+  bool count_reverse_path_validation_stats() const {
+    return count_reverse_path_validation_stats_;
+  }
+  void set_count_reverse_path_validation_stats(bool value) {
+    count_reverse_path_validation_stats_ = value;
+  }
+
  private:
   friend class test::QuicConnectionPeer;
 
@@ -2300,6 +2307,9 @@
   // confirmed.
   bool accelerated_server_preferred_address_ = false;
 
+  // TODO(b/223634460) Remove this.
+  bool count_reverse_path_validation_stats_ = false;
+
   // If true, throttle sending if next created packet will exceed amplification
   // limit.
   const bool enforce_strict_amplification_factor_ =