OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_MULTI_THREADED_CERT_VERIFIER_H_ | 5 #ifndef NET_CERT_MULTI_THREADED_CERT_VERIFIER_H_ |
6 #define NET_CERT_MULTI_THREADED_CERT_VERIFIER_H_ | 6 #define NET_CERT_MULTI_THREADED_CERT_VERIFIER_H_ |
7 | 7 |
| 8 #include <stdint.h> |
8 #include <set> | 9 #include <set> |
9 #include <string> | 10 #include <string> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/basictypes.h" | |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
15 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
16 #include "net/base/completion_callback.h" | 17 #include "net/base/completion_callback.h" |
17 #include "net/base/expiring_cache.h" | 18 #include "net/base/expiring_cache.h" |
18 #include "net/base/hash_value.h" | 19 #include "net/base/hash_value.h" |
19 #include "net/base/net_export.h" | 20 #include "net/base/net_export.h" |
20 #include "net/cert/cert_database.h" | 21 #include "net/cert/cert_database.h" |
21 #include "net/cert/cert_verifier.h" | 22 #include "net/cert/cert_verifier.h" |
22 #include "net/cert/cert_verify_result.h" | 23 #include "net/cert/cert_verify_result.h" |
23 #include "net/cert/x509_cert_types.h" | 24 #include "net/cert/x509_cert_types.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // null. | 150 // null. |
150 CertVerifierJob* FindJob(const RequestParams& key); | 151 CertVerifierJob* FindJob(const RequestParams& key); |
151 | 152 |
152 // Removes |job| from the inflight set, and passes ownership back to the | 153 // Removes |job| from the inflight set, and passes ownership back to the |
153 // caller. |job| must already be |inflight_|. | 154 // caller. |job| must already be |inflight_|. |
154 scoped_ptr<CertVerifierJob> RemoveJob(CertVerifierJob* job); | 155 scoped_ptr<CertVerifierJob> RemoveJob(CertVerifierJob* job); |
155 | 156 |
156 // For unit testing. | 157 // For unit testing. |
157 void ClearCache() { cache_.Clear(); } | 158 void ClearCache() { cache_.Clear(); } |
158 size_t GetCacheSize() const { return cache_.size(); } | 159 size_t GetCacheSize() const { return cache_.size(); } |
159 uint64 cache_hits() const { return cache_hits_; } | 160 uint64_t cache_hits() const { return cache_hits_; } |
160 uint64 requests() const { return requests_; } | 161 uint64_t requests() const { return requests_; } |
161 uint64 inflight_joins() const { return inflight_joins_; } | 162 uint64_t inflight_joins() const { return inflight_joins_; } |
162 | 163 |
163 // cache_ maps from a request to a cached result. | 164 // cache_ maps from a request to a cached result. |
164 CertVerifierCache cache_; | 165 CertVerifierCache cache_; |
165 | 166 |
166 // inflight_ holds the jobs for which an active verification is taking place. | 167 // inflight_ holds the jobs for which an active verification is taking place. |
167 JobSet inflight_; | 168 JobSet inflight_; |
168 | 169 |
169 uint64 requests_; | 170 uint64_t requests_; |
170 uint64 cache_hits_; | 171 uint64_t cache_hits_; |
171 uint64 inflight_joins_; | 172 uint64_t inflight_joins_; |
172 | 173 |
173 scoped_refptr<CertVerifyProc> verify_proc_; | 174 scoped_refptr<CertVerifyProc> verify_proc_; |
174 | 175 |
175 CertTrustAnchorProvider* trust_anchor_provider_; | 176 CertTrustAnchorProvider* trust_anchor_provider_; |
176 | 177 |
177 DISALLOW_COPY_AND_ASSIGN(MultiThreadedCertVerifier); | 178 DISALLOW_COPY_AND_ASSIGN(MultiThreadedCertVerifier); |
178 }; | 179 }; |
179 | 180 |
180 } // namespace net | 181 } // namespace net |
181 | 182 |
182 #endif // NET_CERT_MULTI_THREADED_CERT_VERIFIER_H_ | 183 #endif // NET_CERT_MULTI_THREADED_CERT_VERIFIER_H_ |
OLD | NEW |