Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: net/quic/core/crypto/quic_compressed_certs_cache.h

Issue 2603843002: Add QuicLRUCache. (Closed)
Patch Set: update comment of Lookup Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/net.gypi ('k') | net/quic/core/crypto/quic_compressed_certs_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
12 #include "net/quic/core/crypto/proof_source.h" 11 #include "net/quic/core/crypto/proof_source.h"
13 #include "net/quic/platform/api/quic_export.h" 12 #include "net/quic/platform/api/quic_export.h"
13 #include "net/quic/platform/api/quic_lru_cache.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 // QuicCompressedCertsCache is a cache to track most recently compressed certs. 17 // QuicCompressedCertsCache is a cache to track most recently compressed certs.
18 class QUIC_EXPORT_PRIVATE QuicCompressedCertsCache { 18 class QUIC_EXPORT_PRIVATE QuicCompressedCertsCache {
19 public: 19 public:
20 explicit QuicCompressedCertsCache(int64_t max_num_certs); 20 explicit QuicCompressedCertsCache(int64_t max_num_certs);
21 ~QuicCompressedCertsCache(); 21 ~QuicCompressedCertsCache();
22 22
23 // Returns the pointer to the cached compressed cert if 23 // Returns the pointer to the cached compressed cert if
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 const std::string compressed_cert_; 93 const std::string compressed_cert_;
94 }; 94 };
95 95
96 // Computes a uint64_t hash for |uncompressed_certs|. 96 // Computes a uint64_t hash for |uncompressed_certs|.
97 uint64_t ComputeUncompressedCertsHash( 97 uint64_t ComputeUncompressedCertsHash(
98 const UncompressedCerts& uncompressed_certs); 98 const UncompressedCerts& uncompressed_certs);
99 99
100 // 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
101 // CachedCerts which has both original uncompressed certs data and the 101 // CachedCerts which has both original uncompressed certs data and the
102 // compressed representation of the certs. 102 // compressed representation of the certs.
103 base::MRUCache<uint64_t, CachedCerts> certs_cache_; 103 QuicLRUCache<uint64_t, CachedCerts> certs_cache_;
104 }; 104 };
105 105
106 } // namespace net 106 } // namespace net
107 107
108 #endif // NET_QUIC_CORE_CRYPTO_QUIC_COMPRESSED_CERTS_CACHE_H_ 108 #endif // NET_QUIC_CORE_CRYPTO_QUIC_COMPRESSED_CERTS_CACHE_H_
OLDNEW
« no previous file with comments | « net/net.gypi ('k') | net/quic/core/crypto/quic_compressed_certs_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698