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 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 // Certs stored by QuicCompressedCertsCache where uncompressed certs data is | 68 // Certs stored by QuicCompressedCertsCache where uncompressed certs data is |
69 // used to identify the uncompressed representation of certs and | 69 // used to identify the uncompressed representation of certs and |
70 // |compressed_cert| is the cached compressed representation. | 70 // |compressed_cert| is the cached compressed representation. |
71 class CachedCerts { | 71 class CachedCerts { |
72 public: | 72 public: |
73 CachedCerts(); | 73 CachedCerts(); |
74 CachedCerts(const UncompressedCerts& uncompressed_certs, | 74 CachedCerts(const UncompressedCerts& uncompressed_certs, |
75 const std::string& compressed_cert); | 75 const std::string& compressed_cert); |
76 CachedCerts(const CachedCerts& other); | 76 CachedCerts(const CachedCerts& other); |
77 | |
78 ~CachedCerts(); | 77 ~CachedCerts(); |
79 | 78 |
80 // Returns true if the |uncompressed_certs| matches uncompressed | 79 // Returns true if the |uncompressed_certs| matches uncompressed |
81 // representation of this cert. | 80 // representation of this cert. |
82 bool MatchesUncompressedCerts( | 81 bool MatchesUncompressedCerts( |
83 const UncompressedCerts& uncompressed_certs) const; | 82 const UncompressedCerts& uncompressed_certs) const; |
84 | 83 |
85 const std::string* compressed_cert() const; | 84 const std::string* compressed_cert() const; |
86 | 85 |
87 private: | 86 private: |
(...skipping 12 matching lines...) Expand all Loading... |
100 | 99 |
101 // Key is a unit64_t hash for UncompressedCerts. Stored associated value is | 100 // Key is a unit64_t hash for UncompressedCerts. Stored associated value is |
102 // CachedCerts which has both original uncompressed certs data and the | 101 // CachedCerts which has both original uncompressed certs data and the |
103 // compressed representation of the certs. | 102 // compressed representation of the certs. |
104 base::MRUCache<uint64_t, CachedCerts> certs_cache_; | 103 base::MRUCache<uint64_t, CachedCerts> certs_cache_; |
105 }; | 104 }; |
106 | 105 |
107 } // namespace net | 106 } // namespace net |
108 | 107 |
109 #endif // NET_QUIC_CORE_CRYPTO_QUIC_COMPRESSED_CERTS_CACHE_H_ | 108 #endif // NET_QUIC_CORE_CRYPTO_QUIC_COMPRESSED_CERTS_CACHE_H_ |
OLD | NEW |