Move code to record REJ building

This is a no-op refactor which moves code to poke the rejection observer out of
ProcessClientHelloAfterGetProof.  Rejections will shortly be built in more than
one place, and this change will reduce code duplication then.

gfe-relnote: No-op refactor, not flag-protected.
PiperOrigin-RevId: 239635790
Change-Id: I4b822a616ee0936dcf24c1ad2eb2adb87e861b2b
diff --git a/quic/core/crypto/quic_crypto_server_config.cc b/quic/core/crypto/quic_crypto_server_config.cc
index daa8d07..1c9fd92 100644
--- a/quic/core/crypto/quic_crypto_server_config.cc
+++ b/quic/core/crypto/quic_crypto_server_config.cc
@@ -705,12 +705,8 @@
 
   auto out = QuicMakeUnique<CryptoHandshakeMessage>();
   if (!context->info().reject_reasons.empty() || !configs.requested) {
-    BuildRejection(*context, *configs.primary, context->info().reject_reasons,
-                   out.get());
-    if (rejection_observer_ != nullptr) {
-      rejection_observer_->OnRejectionBuilt(context->info().reject_reasons,
-                                            out.get());
-    }
+    BuildRejectionAndRecordStats(*context, *configs.primary,
+                                 context->info().reject_reasons, out.get());
     context->Succeed(std::move(out), std::move(out_diversification_nonce),
                      std::move(proof_source_details));
     return;
@@ -1329,6 +1325,17 @@
   cb->Run(true, message);
 }
 
+void QuicCryptoServerConfig::BuildRejectionAndRecordStats(
+    const ProcessClientHelloContext& context,
+    const Config& config,
+    const std::vector<uint32_t>& reject_reasons,
+    CryptoHandshakeMessage* out) const {
+  BuildRejection(context, config, reject_reasons, out);
+  if (rejection_observer_ != nullptr) {
+    rejection_observer_->OnRejectionBuilt(reject_reasons, out);
+  }
+}
+
 void QuicCryptoServerConfig::BuildRejection(
     const ProcessClientHelloContext& context,
     const Config& config,