Chromium Code Reviews| Index: net/extras/cert/cert_verifier_cache_persister.h |
| diff --git a/net/extras/cert/cert_verifier_cache_persister.h b/net/extras/cert/cert_verifier_cache_persister.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..631d5c9c404e5052e8ecc809fa4832accff23164 |
| --- /dev/null |
| +++ b/net/extras/cert/cert_verifier_cache_persister.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// CertVerifierCachePersister maintains an in memory database containing the |
| +// list of hosts whose cerificates have been verified. This singleton object |
| +// deals with writing that data out to disk as needed and loading it at startup. |
|
Ryan Sleevi
2016/05/30 18:37:19
1) The first sentence isn't accurate - the CertVer
ramant (doing other things)
2016/06/01 16:29:22
Done.
|
| +// |
| +// At startup we need to load the certificate verification results from the |
| +// disk and we deserialize the data and then pouplate |
| +// CachingCertVerifier's cache. |
| +// |
| +// At shutdown, we serialize CachingCertVerifier's cache and then write |
| +// that data to disk. |
|
Ryan Sleevi
2016/05/30 18:37:19
Lines 9 - 14 are a clear layering violation - you
ramant (doing other things)
2016/06/01 16:29:21
Done.
|
| + |
| +#ifndef NET_EXTRAS_CERT_CERT_VERIFIER_CACHE_PERSISTER_H_ |
| +#define NET_EXTRAS_CERT_CERT_VERIFIER_CACHE_PERSISTER_H_ |
| + |
| +#include <string> |
| +#include <vector> |
|
Ryan Sleevi
2016/05/30 18:37:19
Unused
ramant (doing other things)
2016/06/01 16:29:22
Done.
|
| + |
| +#include "base/compiler_specific.h" |
|
Ryan Sleevi
2016/05/30 18:37:19
What's being used from this header?
ramant (doing other things)
2016/06/01 16:29:22
Done.
|
| +#include "base/macros.h" |
| +#include "net/base/net_export.h" |
| + |
| +namespace net { |
| + |
| +class CachingCertVerifier; |
| + |
| +class NET_EXPORT_PRIVATE CertVerifierCachePersister { |
| + public: |
| + typedef std::vector<std::string> CertVector; |
|
Ryan Sleevi
2016/05/30 18:37:18
Unused.
ramant (doing other things)
2016/06/01 16:29:22
Done.
|
| + |
| + CertVerifierCachePersister(CachingCertVerifier* verifier); |
| + ~CertVerifierCachePersister(); |
| + |
| + // Recursively iterate over this |verifier_|'s |cache_| and all children and |
| + // write the hierarchical structure into |data|. |
| + void SerializeCache(std::string* data); |
| + |
| + // Populates CachingCertVerifier's |cache_|. Returns true if the |data| is |
| + // deserialized correctly. |
| + bool LoadCache(const std::string& data); |
| + |
| + private: |
| + // |verifier_| whose |cache_| will be serialized/deserialized. |
| + CachingCertVerifier* verifier_; // owned |
| + |
| + DISALLOW_COPY_AND_ASSIGN(CertVerifierCachePersister); |
| +}; |
| + |
| +} // namespace net |
| + |
| +#endif // NET_EXTRAS_CERT_CERT_VERIFIER_CACHE_PERSISTER_H_ |