OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_QUIC_CORE_CRYPTO_QUIC_COMPRESSED_CERTS_CACHE_H_ | 5 #ifndef NET_QUIC_CORE_CRYPTO_QUIC_COMPRESSED_CERTS_CACHE_H_ |
6 #define NET_QUIC_CORE_CRYPTO_QUIC_COMPRESSED_CERTS_CACHE_H_ | 6 #define NET_QUIC_CORE_CRYPTO_QUIC_COMPRESSED_CERTS_CACHE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/containers/mru_cache.h" | 11 #include "base/containers/mru_cache.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "net/base/net_export.h" | |
14 #include "net/quic/core/crypto/proof_source.h" | 13 #include "net/quic/core/crypto/proof_source.h" |
| 14 #include "net/quic/platform/api/quic_export.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 // QuicCompressedCertsCache is a cache to track most recently compressed certs. | 18 // QuicCompressedCertsCache is a cache to track most recently compressed certs. |
19 class NET_EXPORT_PRIVATE QuicCompressedCertsCache { | 19 class QUIC_EXPORT_PRIVATE QuicCompressedCertsCache { |
20 public: | 20 public: |
21 explicit QuicCompressedCertsCache(int64_t max_num_certs); | 21 explicit QuicCompressedCertsCache(int64_t max_num_certs); |
22 ~QuicCompressedCertsCache(); | 22 ~QuicCompressedCertsCache(); |
23 | 23 |
24 // Returns the pointer to the cached compressed cert if | 24 // Returns the pointer to the cached compressed cert if |
25 // |chain, client_common_set_hashes, client_cached_cert_hashes| hits cache. | 25 // |chain, client_common_set_hashes, client_cached_cert_hashes| hits cache. |
26 // Otherwise, return nullptr. | 26 // Otherwise, return nullptr. |
27 // Returned pointer might become invalid on the next call to Insert(). | 27 // Returned pointer might become invalid on the next call to Insert(). |
28 const std::string* GetCompressedCert( | 28 const std::string* GetCompressedCert( |
29 const scoped_refptr<ProofSource::Chain>& chain, | 29 const scoped_refptr<ProofSource::Chain>& chain, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 // Key is a unit64_t hash for UncompressedCerts. Stored associated value is | 101 // Key is a unit64_t hash for UncompressedCerts. Stored associated value is |
102 // CachedCerts which has both original uncompressed certs data and the | 102 // CachedCerts which has both original uncompressed certs data and the |
103 // compressed representation of the certs. | 103 // compressed representation of the certs. |
104 base::MRUCache<uint64_t, CachedCerts> certs_cache_; | 104 base::MRUCache<uint64_t, CachedCerts> certs_cache_; |
105 }; | 105 }; |
106 | 106 |
107 } // namespace net | 107 } // namespace net |
108 | 108 |
109 #endif // NET_QUIC_CORE_CRYPTO_QUIC_COMPRESSED_CERTS_CACHE_H_ | 109 #endif // NET_QUIC_CORE_CRYPTO_QUIC_COMPRESSED_CERTS_CACHE_H_ |
OLD | NEW |