Add flag to remove common certs

The common certs contain around ~140kb of data that isn't used in some cases. The flag allows us to remove the data if not used.

Additional flag added won't affect gfe production.

PiperOrigin-RevId: 321615235
Change-Id: I31b675ab95ea7050de074d07438df47cc3e8f6a2
diff --git a/quic/core/crypto/common_cert_set_empty.cc b/quic/core/crypto/common_cert_set_empty.cc
new file mode 100644
index 0000000..537bab9
--- /dev/null
+++ b/quic/core/crypto/common_cert_set_empty.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/third_party/quiche/src/quic/core/crypto/common_cert_set.h"
+
+#include <cstddef>
+
+#include "net/third_party/quiche/src/quic/core/quic_utils.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_arraysize.h"
+#include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
+
+namespace quic {
+
+namespace {
+
+class CommonCertSetsEmpty : public CommonCertSets {
+ public:
+  // CommonCertSets interface.
+  quiche::QuicheStringPiece GetCommonHashes() const override {
+    return quiche::QuicheStringPiece();
+  }
+
+  quiche::QuicheStringPiece GetCert(uint64_t /* hash */,
+                                    uint32_t /* index */) const override {
+    return quiche::QuicheStringPiece();
+  }
+
+  bool MatchCert(quiche::QuicheStringPiece /* cert */,
+                 quiche::QuicheStringPiece /* common_set_hashes */,
+                 uint64_t* /* out_hash */,
+                 uint32_t* /* out_index */) const override {
+    return false;
+  }
+
+  CommonCertSetsEmpty() {}
+  CommonCertSetsEmpty(const CommonCertSetsEmpty&) = delete;
+  CommonCertSetsEmpty& operator=(const CommonCertSetsEmpty&) = delete;
+  ~CommonCertSetsEmpty() override {}
+};
+
+}  // anonymous namespace
+
+CommonCertSets::~CommonCertSets() {}
+
+// static
+const CommonCertSets* CommonCertSets::GetInstanceQUIC() {
+  static CommonCertSetsEmpty* certs = new CommonCertSetsEmpty();
+  return certs;
+}
+
+}  // namespace quic