xref: /aosp_15_r20/external/cronet/net/quic/quic_crypto_client_config_handle.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2019 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef NET_QUIC_QUIC_CRYPTO_CLIENT_CONFIG_HANDLE_H_
6 #define NET_QUIC_QUIC_CRYPTO_CLIENT_CONFIG_HANDLE_H_
7 
8 #include "net/base/net_export.h"
9 
10 namespace quic {
11 class QuicCryptoClientConfig;
12 }  // namespace quic
13 
14 namespace net {
15 
16 // Class that allows consumers to access a quic::QuicCryptoClientConfig, while
17 // ensuring that the QuciStreamFactory that owns it keeps it alive. Once a
18 // QuicCryptoClientConfigHandle is destroyed, the underlying
19 // QuicCryptoClientConfig object may be destroyed as well. All
20 // QuicCryptoClientConfigHandle must be destroyed before the end of the
21 // QuciStreamFactory's destructor.
22 //
23 // This ownership model is used instead of refcounting for stronger safety
24 // guarantees, and because the underlying QuicCryptoClientConfig depends on
25 // other network objects that may be deleted after the QuicSessionPool.
26 class NET_EXPORT_PRIVATE QuicCryptoClientConfigHandle {
27  public:
28   QuicCryptoClientConfigHandle& operator=(const QuicCryptoClientConfigHandle&) =
29       delete;
30 
31   virtual ~QuicCryptoClientConfigHandle();
32 
33   virtual quic::QuicCryptoClientConfig* GetConfig() const = 0;
34 
35  protected:
36   QuicCryptoClientConfigHandle();
37 };
38 
39 }  // namespace net
40 
41 #endif  // NET_QUIC_QUIC_CRYPTO_CLIENT_CONFIG_HANDLE_H_
42