| 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..acd0a91a21a7188f2120dd3a3acc45ef2f7dd88e 100644
|
| --- a/net/cert/multi_threaded_cert_verifier.h
|
| +++ b/net/cert/multi_threaded_cert_verifier.h
|
| @@ -15,6 +15,7 @@
|
| #include "base/gtest_prod_util.h"
|
| #include "base/macros.h"
|
| #include "base/memory/ref_counted.h"
|
| +#include "base/pickle.h"
|
| #include "base/threading/non_thread_safe.h"
|
| #include "net/base/completion_callback.h"
|
| #include "net/base/expiring_cache.h"
|
| @@ -81,8 +82,12 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier
|
| FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest, CancelRequest);
|
| FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest,
|
| RequestParamsComparators);
|
| + FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest, PersistRequestParams);
|
| FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest,
|
| CertTrustAnchorProvider);
|
| + FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest, PersistCache);
|
| + FRIEND_TEST_ALL_PREFIXES(MultiThreadedCertVerifierTest,
|
| + PersistCacheExpiredEntry);
|
|
|
| // Input parameters of a certificate verification request.
|
| struct NET_EXPORT_PRIVATE RequestParams {
|
| @@ -93,8 +98,20 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier
|
| int flags_arg,
|
| const CertificateList& additional_trust_anchors);
|
| RequestParams(const RequestParams& other);
|
| + RequestParams();
|
| ~RequestParams();
|
|
|
| + // Appends a representation of this object to the given pickle.
|
| + bool Persist(base::Pickle* pickle) const;
|
| +
|
| + // Create an RequestParams from the representation stored in the given
|
| + // pickle. The data for this object is found relative to the given
|
| + // pickle_iter, which should be passed to the pickle's various Read*
|
| + // methods.
|
| + // Returns false on failure.
|
| + static bool CreateFromPickle(base::PickleIterator* iter,
|
| + RequestParams* param);
|
| +
|
| bool operator<(const RequestParams& other) const;
|
|
|
| std::string hostname;
|
| @@ -111,6 +128,17 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier
|
| CachedResult();
|
| ~CachedResult();
|
|
|
| + // Appends a representation of this object to the given pickle.
|
| + bool Persist(base::Pickle* pickle) const;
|
| +
|
| + // Create an CachedResult from the representation stored in the given
|
| + // pickle. The data for this object is found relative to the given
|
| + // pickle_iter, which should be passed to the pickle's various Read*
|
| + // methods.
|
| + // Returns false on failure.
|
| + static bool CreateFromPickle(base::PickleIterator* iter,
|
| + CachedResult* result);
|
| +
|
| int error; // The return value of CertVerifier::Verify.
|
| CertVerifyResult result; // The output of CertVerifier::Verify.
|
| };
|
| @@ -123,15 +151,26 @@ 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);
|
|
|
| + // Appends a representation of this object to the given pickle.
|
| + bool Persist(base::Pickle* pickle) const;
|
| +
|
| + // Create an CacheValidityPeriod from the representation stored in the given
|
| + // pickle. The data for this object is found relative to the given
|
| + // pickle_iter, which should be passed to the pickle's various Read*
|
| + // methods.
|
| + // Returns false on failure.
|
| + static bool CreateFromPickle(base::PickleIterator* iter,
|
| + CacheValidityPeriod* valid_period);
|
| +
|
| base::Time verification_time;
|
| 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;
|
| @@ -150,6 +189,16 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier
|
| // Saves |result| into the cache, keyed by |key|.
|
| void SaveResultToCache(const RequestParams& key, const CachedResult& result);
|
|
|
| + // Appends a representation of |cache_| to the given pickle.
|
| + bool SerializeCache(base::Pickle* pickle);
|
| +
|
| + // Populates |cache_| from the representation stored in the given pickle. The
|
| + // data for this object is found relative to the given pickle_iter, which
|
| + // should be passed to the pickle's various Read* methods.
|
| + // Returns false on failure.
|
| + static bool CreateFromPickle(base::PickleIterator* iter,
|
| + MultiThreadedCertVerifier* cert_verifier);
|
| +
|
| // CertDatabase::Observer methods:
|
| void OnCACertChanged(const X509Certificate* cert) override;
|
|
|
|
|