Deprecate quic_framer_uses_undecryptable_upcall

gfe-relnote: deprecate gfe2_restart_flag_quic_framer_uses_undecryptable_upcall
PiperOrigin-RevId: 273643327
Change-Id: I70939b5f6cfc79799ea25166c0cf23a174c86f00
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index d4376cd..7d29b86 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -1723,8 +1723,6 @@
                 << EncryptionLevelToString(decryption_level)
                 << " while connection is at encryption level "
                 << EncryptionLevelToString(encryption_level_);
-  DCHECK(GetQuicRestartFlag(quic_framer_uses_undecryptable_upcall));
-  QUIC_RESTART_FLAG_COUNT_N(quic_framer_uses_undecryptable_upcall, 1, 7);
   DCHECK(EncryptionLevelIsValid(decryption_level));
   if (encryption_level_ != ENCRYPTION_FORWARD_SECURE) {
     ++stats_.undecryptable_packets_received_before_handshake_complete;
@@ -1817,20 +1815,6 @@
   if (!framer_.ProcessPacket(packet)) {
     // If we are unable to decrypt this packet, it might be
     // because the CHLO or SHLO packet was lost.
-    if (framer_.error() == QUIC_DECRYPTION_FAILURE &&
-        !GetQuicRestartFlag(quic_framer_uses_undecryptable_upcall)) {
-      if (encryption_level_ != ENCRYPTION_FORWARD_SECURE) {
-        ++stats_.undecryptable_packets_received_before_handshake_complete;
-      }
-      if (encryption_level_ != ENCRYPTION_FORWARD_SECURE &&
-          undecryptable_packets_.size() < max_undecryptable_packets_) {
-        QueueUndecryptablePacket(packet);
-      } else if (debug_visitor_ != nullptr) {
-        debug_visitor_->OnUndecryptablePacket();
-      }
-    } else if (GetQuicRestartFlag(quic_framer_uses_undecryptable_upcall)) {
-      QUIC_RESTART_FLAG_COUNT_N(quic_framer_uses_undecryptable_upcall, 2, 7);
-    }
     QUIC_DVLOG(1) << ENDPOINT
                   << "Unable to process packet.  Last packet processed: "
                   << last_header_.packet_number;
@@ -2817,8 +2801,6 @@
 
 void QuicConnection::QueueUndecryptablePacket(
     const QuicEncryptedPacket& packet) {
-  if (GetQuicRestartFlag(quic_framer_uses_undecryptable_upcall)) {
-    QUIC_RESTART_FLAG_COUNT_N(quic_framer_uses_undecryptable_upcall, 3, 7);
     for (const auto& saved_packet : undecryptable_packets_) {
       if (packet.data() == saved_packet->data() &&
           packet.length() == saved_packet->length()) {
@@ -2826,7 +2808,6 @@
         return;
       }
     }
-  }
   QUIC_DVLOG(1) << ENDPOINT << "Queueing undecryptable packet.";
   undecryptable_packets_.push_back(packet.Clone());
 }
@@ -2899,20 +2880,6 @@
     } else {
       // If we are unable to decrypt this packet, it might be
       // because the CHLO or SHLO packet was lost.
-      if (framer_.error() == QUIC_DECRYPTION_FAILURE &&
-          !GetQuicRestartFlag(quic_framer_uses_undecryptable_upcall)) {
-        if (encryption_level_ != ENCRYPTION_FORWARD_SECURE) {
-          ++stats_.undecryptable_packets_received_before_handshake_complete;
-        }
-        if (encryption_level_ != ENCRYPTION_FORWARD_SECURE &&
-            undecryptable_packets_.size() < max_undecryptable_packets_) {
-          QueueUndecryptablePacket(*packet);
-        } else if (debug_visitor_ != nullptr) {
-          debug_visitor_->OnUndecryptablePacket();
-        }
-      } else if (GetQuicRestartFlag(quic_framer_uses_undecryptable_upcall)) {
-        QUIC_RESTART_FLAG_COUNT_N(quic_framer_uses_undecryptable_upcall, 4, 7);
-      }
     }
   }
   if (processed) {
diff --git a/quic/core/quic_framer.cc b/quic/core/quic_framer.cc
index 17898a4..402135b 100644
--- a/quic/core/quic_framer.cc
+++ b/quic/core/quic_framer.cc
@@ -1699,16 +1699,12 @@
         return true;
       }
       if (hp_removal_failed) {
-        if (GetQuicRestartFlag(quic_framer_uses_undecryptable_upcall)) {
-          QUIC_RESTART_FLAG_COUNT_N(quic_framer_uses_undecryptable_upcall, 5,
-                                    7);
           const EncryptionLevel decryption_level = GetEncryptionLevel(*header);
           const bool has_decryption_key =
               decrypter_[decryption_level] != nullptr;
           visitor_->OnUndecryptablePacket(
               QuicEncryptedPacket(encrypted_reader->FullPayload()),
               decryption_level, has_decryption_key);
-        }
         set_detailed_error("Unable to decrypt header protection.");
         return RaiseError(QUIC_DECRYPTION_FAILURE);
       }
@@ -1767,15 +1763,12 @@
       visitor_->OnAuthenticatedIetfStatelessResetPacket(packet);
       return true;
     }
-    if (GetQuicRestartFlag(quic_framer_uses_undecryptable_upcall)) {
-      QUIC_RESTART_FLAG_COUNT_N(quic_framer_uses_undecryptable_upcall, 6, 7);
       const EncryptionLevel decryption_level = GetEncryptionLevel(*header);
       const bool has_decryption_key = version_.KnowsWhichDecrypterToUse() &&
                                       decrypter_[decryption_level] != nullptr;
       visitor_->OnUndecryptablePacket(
           QuicEncryptedPacket(encrypted_reader->FullPayload()),
           decryption_level, has_decryption_key);
-    }
     set_detailed_error("Unable to decrypt payload.");
     RecordDroppedPacketReason(DroppedPacketReason::DECRYPTION_FAILURE);
     return RaiseError(QUIC_DECRYPTION_FAILURE);
@@ -1857,8 +1850,6 @@
   EncryptionLevel decrypted_level;
   if (!DecryptPayload(encrypted, associated_data, *header, decrypted_buffer,
                       buffer_length, &decrypted_length, &decrypted_level)) {
-    if (GetQuicRestartFlag(quic_framer_uses_undecryptable_upcall)) {
-      QUIC_RESTART_FLAG_COUNT_N(quic_framer_uses_undecryptable_upcall, 7, 7);
       const EncryptionLevel decryption_level = decrypter_level_;
       // This version uses trial decryption so we always report to our visitor
       // that we are not certain we have the correct decryption key.
@@ -1866,7 +1857,6 @@
       visitor_->OnUndecryptablePacket(
           QuicEncryptedPacket(encrypted_reader->FullPayload()),
           decryption_level, has_decryption_key);
-    }
     RecordDroppedPacketReason(DroppedPacketReason::DECRYPTION_FAILURE);
     set_detailed_error("Unable to decrypt payload.");
     return RaiseError(QUIC_DECRYPTION_FAILURE);
diff --git a/quic/core/quic_framer_test.cc b/quic/core/quic_framer_test.cc
index c7e67fc..14de6e9 100644
--- a/quic/core/quic_framer_test.cc
+++ b/quic/core/quic_framer_test.cc
@@ -12191,7 +12191,6 @@
   EXPECT_FALSE(
       framer_.ProcessPacket(QuicEncryptedPacket(AsChars(p), p_length, false)));
   EXPECT_EQ(QUIC_DECRYPTION_FAILURE, framer_.error());
-  if (GetQuicRestartFlag(quic_framer_uses_undecryptable_upcall)) {
     ASSERT_EQ(1u, visitor_.undecryptable_packets_.size());
     ASSERT_EQ(1u, visitor_.undecryptable_decryption_levels_.size());
     ASSERT_EQ(1u, visitor_.undecryptable_has_decryption_keys_.size());
@@ -12203,11 +12202,6 @@
                 visitor_.undecryptable_decryption_levels_[0]);
     }
     EXPECT_FALSE(visitor_.undecryptable_has_decryption_keys_[0]);
-  } else {
-    EXPECT_EQ(0u, visitor_.undecryptable_packets_.size());
-    EXPECT_EQ(0u, visitor_.undecryptable_decryption_levels_.size());
-    EXPECT_EQ(0u, visitor_.undecryptable_has_decryption_keys_.size());
-  }
 }
 
 TEST_P(QuicFramerTest, UndecryptablePacketWithDecrypter) {
@@ -12299,7 +12293,6 @@
   EXPECT_FALSE(
       framer_.ProcessPacket(QuicEncryptedPacket(AsChars(p), p_length, false)));
   EXPECT_EQ(QUIC_DECRYPTION_FAILURE, framer_.error());
-  if (GetQuicRestartFlag(quic_framer_uses_undecryptable_upcall)) {
     ASSERT_EQ(1u, visitor_.undecryptable_packets_.size());
     ASSERT_EQ(1u, visitor_.undecryptable_decryption_levels_.size());
     ASSERT_EQ(1u, visitor_.undecryptable_has_decryption_keys_.size());
@@ -12312,11 +12305,6 @@
     }
     EXPECT_EQ(framer_.version().KnowsWhichDecrypterToUse(),
               visitor_.undecryptable_has_decryption_keys_[0]);
-  } else {
-    EXPECT_EQ(0u, visitor_.undecryptable_packets_.size());
-    EXPECT_EQ(0u, visitor_.undecryptable_decryption_levels_.size());
-    EXPECT_EQ(0u, visitor_.undecryptable_has_decryption_keys_.size());
-  }
 }
 
 TEST_P(QuicFramerTest, UndecryptableCoalescedPacket) {
@@ -12469,7 +12457,6 @@
 
   EXPECT_EQ(QUIC_DECRYPTION_FAILURE, framer_.error());
 
-  if (GetQuicRestartFlag(quic_framer_uses_undecryptable_upcall)) {
     ASSERT_EQ(1u, visitor_.undecryptable_packets_.size());
     ASSERT_EQ(1u, visitor_.undecryptable_decryption_levels_.size());
     ASSERT_EQ(1u, visitor_.undecryptable_has_decryption_keys_.size());
@@ -12482,11 +12469,6 @@
     EXPECT_EQ(ENCRYPTION_HANDSHAKE,
               visitor_.undecryptable_decryption_levels_[0]);
     EXPECT_TRUE(visitor_.undecryptable_has_decryption_keys_[0]);
-  } else {
-    EXPECT_EQ(0u, visitor_.undecryptable_packets_.size());
-    EXPECT_EQ(0u, visitor_.undecryptable_decryption_levels_.size());
-    EXPECT_EQ(0u, visitor_.undecryptable_has_decryption_keys_.size());
-  }
 
   // Make sure the second coalesced packet is parsed correctly.
   ASSERT_EQ(visitor_.coalesced_packets_.size(), 1u);