| 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_CERT_CACHING_CERT_VERIFIER_H_ | 5 #ifndef NET_CERT_CACHING_CERT_VERIFIER_H_ |
| 6 #define NET_CERT_CACHING_CERT_VERIFIER_H_ | 6 #define NET_CERT_CACHING_CERT_VERIFIER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "net/base/expiring_cache.h" | 10 #include "net/base/expiring_cache.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 // Adds |verify_result| and |error| to the cache for |params|, whose | 138 // Adds |verify_result| and |error| to the cache for |params|, whose |
| 139 // verification attempt began at |start_time|. See the implementation | 139 // verification attempt began at |start_time|. See the implementation |
| 140 // for more details about the necessity of |start_time|. | 140 // for more details about the necessity of |start_time|. |
| 141 void AddResultToCache(const RequestParams& params, | 141 void AddResultToCache(const RequestParams& params, |
| 142 base::Time start_time, | 142 base::Time start_time, |
| 143 const CertVerifyResult& verify_result, | 143 const CertVerifyResult& verify_result, |
| 144 int error); | 144 int error); |
| 145 | 145 |
| 146 // CertDatabase::Observer methods: | 146 // CertDatabase::Observer methods: |
| 147 void OnCACertChanged(const X509Certificate* cert) override; | 147 void OnCertDBChanged(const X509Certificate* cert) override; |
| 148 | 148 |
| 149 // For unit testing. | 149 // For unit testing. |
| 150 void ClearCache(); | 150 void ClearCache(); |
| 151 size_t GetCacheSize() const; | 151 size_t GetCacheSize() const; |
| 152 uint64_t cache_hits() const { return cache_hits_; } | 152 uint64_t cache_hits() const { return cache_hits_; } |
| 153 uint64_t requests() const { return requests_; } | 153 uint64_t requests() const { return requests_; } |
| 154 | 154 |
| 155 std::unique_ptr<CertVerifier> verifier_; | 155 std::unique_ptr<CertVerifier> verifier_; |
| 156 | 156 |
| 157 CertVerificationCache cache_; | 157 CertVerificationCache cache_; |
| 158 | 158 |
| 159 uint64_t requests_; | 159 uint64_t requests_; |
| 160 uint64_t cache_hits_; | 160 uint64_t cache_hits_; |
| 161 | 161 |
| 162 DISALLOW_COPY_AND_ASSIGN(CachingCertVerifier); | 162 DISALLOW_COPY_AND_ASSIGN(CachingCertVerifier); |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 } // namespace net | 165 } // namespace net |
| 166 | 166 |
| 167 #endif // NET_CERT_CACHING_CERT_VERIFIER_H_ | 167 #endif // NET_CERT_CACHING_CERT_VERIFIER_H_ |
| OLD | NEW |