Deprecate quic_use_allocated_connection_ids

gfe-relnote: deprecate gfe2_restart_flag_quic_use_allocated_connection_ids
PiperOrigin-RevId: 264243557
Change-Id: Ib7ba3b1a3151a11dd88838755a2924fa73dd2b03
diff --git a/quic/core/quic_connection_id.cc b/quic/core/quic_connection_id.cc
index c6ef07b..67b5d13 100644
--- a/quic/core/quic_connection_id.cc
+++ b/quic/core/quic_connection_id.cc
@@ -65,11 +65,6 @@
   if (length_ == 0) {
     return;
   }
-  if (!GetQuicRestartFlag(quic_use_allocated_connection_ids)) {
-    memcpy(data_, data, length_);
-    return;
-  }
-  QUIC_RESTART_FLAG_COUNT_N(quic_use_allocated_connection_ids, 1, 6);
   if (length_ <= sizeof(data_short_)) {
     memcpy(data_short_, data, length_);
     return;
@@ -80,10 +75,6 @@
 }
 
 QuicConnectionId::~QuicConnectionId() {
-  if (!GetQuicRestartFlag(quic_use_allocated_connection_ids)) {
-    return;
-  }
-  QUIC_RESTART_FLAG_COUNT_N(quic_use_allocated_connection_ids, 2, 6);
   if (length_ > sizeof(data_short_)) {
     free(data_long_);
     data_long_ = nullptr;
@@ -100,10 +91,6 @@
 }
 
 const char* QuicConnectionId::data() const {
-  if (!GetQuicRestartFlag(quic_use_allocated_connection_ids)) {
-    return data_;
-  }
-  QUIC_RESTART_FLAG_COUNT_N(quic_use_allocated_connection_ids, 3, 6);
   if (length_ <= sizeof(data_short_)) {
     return data_short_;
   }
@@ -111,10 +98,6 @@
 }
 
 char* QuicConnectionId::mutable_data() {
-  if (!GetQuicRestartFlag(quic_use_allocated_connection_ids)) {
-    return data_;
-  }
-  QUIC_RESTART_FLAG_COUNT_N(quic_use_allocated_connection_ids, 4, 6);
   if (length_ <= sizeof(data_short_)) {
     return data_short_;
   }
@@ -131,30 +114,27 @@
              << static_cast<int>(length);
     length = kQuicMaxConnectionIdAllVersionsLength;
   }
-  if (GetQuicRestartFlag(quic_use_allocated_connection_ids)) {
-    QUIC_RESTART_FLAG_COUNT_N(quic_use_allocated_connection_ids, 5, 6);
-    char temporary_data[sizeof(data_short_)];
-    if (length > sizeof(data_short_)) {
-      if (length_ <= sizeof(data_short_)) {
-        // Copy data from data_short_ to data_long_.
-        memcpy(temporary_data, data_short_, length_);
-        data_long_ = reinterpret_cast<char*>(malloc(length));
-        CHECK_NE(nullptr, data_long_);
-        memcpy(data_long_, temporary_data, length_);
-      } else {
-        // Resize data_long_.
-        char* realloc_result =
-            reinterpret_cast<char*>(realloc(data_long_, length));
-        CHECK_NE(nullptr, realloc_result);
-        data_long_ = realloc_result;
-      }
-    } else if (length_ > sizeof(data_short_)) {
-      // Copy data from data_long_ to data_short_.
-      memcpy(temporary_data, data_long_, length);
-      free(data_long_);
-      data_long_ = nullptr;
-      memcpy(data_short_, temporary_data, length);
+  char temporary_data[sizeof(data_short_)];
+  if (length > sizeof(data_short_)) {
+    if (length_ <= sizeof(data_short_)) {
+      // Copy data from data_short_ to data_long_.
+      memcpy(temporary_data, data_short_, length_);
+      data_long_ = reinterpret_cast<char*>(malloc(length));
+      CHECK_NE(nullptr, data_long_);
+      memcpy(data_long_, temporary_data, length_);
+    } else {
+      // Resize data_long_.
+      char* realloc_result =
+          reinterpret_cast<char*>(realloc(data_long_, length));
+      CHECK_NE(nullptr, realloc_result);
+      data_long_ = realloc_result;
     }
+  } else if (length_ > sizeof(data_short_)) {
+    // Copy data from data_long_ to data_short_.
+    memcpy(temporary_data, data_long_, length);
+    free(data_long_);
+    data_long_ = nullptr;
+    memcpy(data_short_, temporary_data, length);
   }
   length_ = length;
 }
diff --git a/quic/core/quic_connection_id.h b/quic/core/quic_connection_id.h
index 0b8c06a..431cc74 100644
--- a/quic/core/quic_connection_id.h
+++ b/quic/core/quic_connection_id.h
@@ -105,15 +105,12 @@
   uint8_t length_;  // length of the connection ID, in bytes.
   // The connection ID is represented in network byte order.
   union {
-    // When quic_use_allocated_connection_ids is false, the connection ID is
-    // stored in the first |length_| bytes of |data_|.
-    char data_[kQuicMaxConnectionIdAllVersionsLength];
-    // When quic_use_allocated_connection_ids is true, if the connection ID
-    // fits in |data_short_|, it is stored in the first |length_| bytes of
-    // |data_short_|. Otherwise it is stored in |data_long_| which is
-    // guaranteed to have a size equal to |length_|. A value of 11 was chosen
-    // because our commonly used connection ID length is 8 and with the length,
-    // the class is padded to 12 bytes anyway.
+    // If the connection ID fits in |data_short_|, it is stored in the
+    // first |length_| bytes of |data_short_|.
+    // Otherwise it is stored in |data_long_| which is guaranteed to have a size
+    // equal to |length_|.
+    // A value of 11 was chosen because our commonly used connection ID length
+    // is 8 and with the length, the class is padded to 12 bytes anyway.
     char data_short_[11];
     char* data_long_;
   };
diff --git a/quic/core/quic_data_reader.cc b/quic/core/quic_data_reader.cc
index 87e9645..c9a76be 100644
--- a/quic/core/quic_data_reader.cc
+++ b/quic/core/quic_data_reader.cc
@@ -146,15 +146,6 @@
     return true;
   }
 
-  if (!GetQuicRestartFlag(quic_use_allocated_connection_ids)) {
-    const bool ok = ReadBytes(connection_id->mutable_data(), length);
-    if (ok) {
-      connection_id->set_length(length);
-    }
-    return ok;
-  }
-  QUIC_RESTART_FLAG_COUNT_N(quic_use_allocated_connection_ids, 6, 6);
-
   if (BytesRemaining() < length) {
     return false;
   }
diff --git a/quic/core/quic_versions.cc b/quic/core/quic_versions.cc
index 29fc3fa..1292d0d 100644
--- a/quic/core/quic_versions.cc
+++ b/quic/core/quic_versions.cc
@@ -474,7 +474,6 @@
   SetQuicFlag(FLAGS_quic_supports_tls_handshake, true);
   SetQuicReloadableFlag(quic_simplify_stop_waiting, true);
   SetQuicReloadableFlag(quic_use_parse_public_header, true);
-  SetQuicRestartFlag(quic_use_allocated_connection_ids, true);
   SetQuicRestartFlag(quic_dispatcher_hands_chlo_extractor_one_version, true);
 }