quic_crypto_client_stream_factory.cc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright (c) 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "net/quic/quic_crypto_client_stream_factory.h"
  5. #include "base/lazy_instance.h"
  6. #include "net/quic/crypto/proof_verifier_chromium.h"
  7. #include "net/quic/quic_chromium_client_session.h"
  8. #include "net/third_party/quiche/src/quiche/quic/core/quic_crypto_client_stream.h"
  9. namespace net {
  10. namespace {
  11. class DefaultCryptoStreamFactory : public QuicCryptoClientStreamFactory {
  12. public:
  13. std::unique_ptr<quic::QuicCryptoClientStream> CreateQuicCryptoClientStream(
  14. const quic::QuicServerId& server_id,
  15. QuicChromiumClientSession* session,
  16. std::unique_ptr<quic::ProofVerifyContext> proof_verify_context,
  17. quic::QuicCryptoClientConfig* crypto_config) override {
  18. return std::make_unique<quic::QuicCryptoClientStream>(
  19. server_id, session, std::move(proof_verify_context), crypto_config,
  20. session, /*has_application_state = */ true);
  21. }
  22. };
  23. static base::LazyInstance<DefaultCryptoStreamFactory>::Leaky
  24. g_default_crypto_stream_factory = LAZY_INSTANCE_INITIALIZER;
  25. } // namespace
  26. // static
  27. QuicCryptoClientStreamFactory*
  28. QuicCryptoClientStreamFactory::GetDefaultFactory() {
  29. return g_default_crypto_stream_factory.Pointer();
  30. }
  31. } // namespace net