Index: net/cert/multi_threaded_cert_verifier.h |
diff --git a/net/cert/multi_threaded_cert_verifier.h b/net/cert/multi_threaded_cert_verifier.h |
index 83d00dd583e0bb0668e6706c0514f4b8e3704e5f..57126918dd7bba3cdd05f9fdbe35ec68ce803d33 100644 |
--- a/net/cert/multi_threaded_cert_verifier.h |
+++ b/net/cert/multi_threaded_cert_verifier.h |
@@ -71,6 +71,8 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier |
private: |
struct JobToRequestParamsComparator; |
+ friend class CertVerifierCachePersister; |
Ryan Sleevi
2016/04/16 00:36:15
The design I suggested was so we could explicitly
ramant (doing other things)
2016/04/21 16:41:54
Done.
|
+ friend class CertVerifierCachePersisterTest; |
friend class CertVerifierRequest; |
friend class CertVerifierJob; |
friend class MultiThreadedCertVerifierTest; |
@@ -83,6 +85,9 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier |
RequestParamsComparators); |
FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest, |
CertTrustAnchorProvider); |
+ FRIEND_TEST_ALL_PREFIXES(CertVerifierCachePersisterTest, PersistCache); |
+ FRIEND_TEST_ALL_PREFIXES(CertVerifierCachePersisterTest, |
+ PersistCacheExpiredEntry); |
// Input parameters of a certificate verification request. |
struct NET_EXPORT_PRIVATE RequestParams { |
@@ -93,6 +98,7 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier |
int flags_arg, |
const CertificateList& additional_trust_anchors); |
RequestParams(const RequestParams& other); |
+ RequestParams(); |
Ryan Sleevi
2016/04/16 00:36:15
I'd like to avoid this, because it leaves RequestP
ramant (doing other things)
2016/04/21 16:41:54
Done.
|
~RequestParams(); |
bool operator<(const RequestParams& other) const; |
@@ -123,7 +129,7 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier |
// ensure that expiration is measured both by the 'general' case (now + cache |
// TTL) and by whether or not significant enough clock skew was introduced |
// since the last verification. |
- struct CacheValidityPeriod { |
+ struct NET_EXPORT_PRIVATE CacheValidityPeriod { |
explicit CacheValidityPeriod(const base::Time& now); |
CacheValidityPeriod(const base::Time& now, const base::Time& expiration); |
@@ -131,7 +137,7 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier |
base::Time expiration_time; |
}; |
- struct CacheExpirationFunctor { |
+ struct NET_EXPORT_PRIVATE CacheExpirationFunctor { |
// Returns true iff |now| is within the validity period of |expiration|. |
bool operator()(const CacheValidityPeriod& now, |
const CacheValidityPeriod& expiration) const; |
@@ -147,6 +153,52 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier |
typedef ExpiringCache<RequestParams, CachedResult, CacheValidityPeriod, |
CacheExpirationFunctor> CertVerifierCache; |
+ class NET_EXPORT CertVerifierCacheIterator { |
Ryan Sleevi
2016/04/16 00:36:15
NAMING: This is highly redundant naming; just Iter
ramant (doing other things)
2016/04/21 16:41:54
Done.
|
+ public: |
+ explicit CertVerifierCacheIterator( |
+ const MultiThreadedCertVerifier& verifier); |
+ ~CertVerifierCacheIterator(); |
+ |
+ bool HasNext() const { return iterator_.HasNext(); } |
+ void Advance() { iterator_.Advance(); } |
+ |
+ const std::string& hostname() const { |
+ const RequestParams& key = iterator_.key(); |
+ return key.hostname; |
+ } |
+ int flags() const { |
+ const RequestParams& key = iterator_.key(); |
+ return key.flags; |
+ } |
+ const std::vector<SHA1HashValue>& hash_values() const { |
+ const RequestParams& key = iterator_.key(); |
+ return key.hash_values; |
+ } |
+ const base::Time& start_time() const { |
+ const RequestParams& key = iterator_.key(); |
+ return key.start_time; |
+ } |
+ int error() const { |
+ const CachedResult& value = iterator_.value(); |
+ return value.error; |
+ } |
+ const CertVerifyResult& result() const { |
+ const CachedResult& value = iterator_.value(); |
+ return value.result; |
+ } |
+ const base::Time& verification_time() const { |
+ const CacheValidityPeriod& expiration = iterator_.expiration(); |
+ return expiration.verification_time; |
+ } |
+ const base::Time& expiration_time() const { |
+ const CacheValidityPeriod& expiration = iterator_.expiration(); |
+ return expiration.expiration_time; |
+ } |
+ |
+ private: |
+ CertVerifierCache::Iterator iterator_; |
+ }; |
+ |
// Saves |result| into the cache, keyed by |key|. |
void SaveResultToCache(const RequestParams& key, const CachedResult& result); |