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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <memory> | 12 #include <memory> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
19 #include "base/threading/non_thread_safe.h" | 19 #include "base/threading/thread_checker.h" |
20 #include "net/base/completion_callback.h" | 20 #include "net/base/completion_callback.h" |
21 #include "net/base/net_export.h" | 21 #include "net/base/net_export.h" |
22 #include "net/cert/cert_verifier.h" | 22 #include "net/cert/cert_verifier.h" |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 | 25 |
26 class CertVerifierJob; | 26 class CertVerifierJob; |
27 class CertVerifierRequest; | 27 class CertVerifierRequest; |
28 class CertVerifyProc; | 28 class CertVerifyProc; |
29 | 29 |
30 // MultiThreadedCertVerifier is a CertVerifier implementation that runs | 30 // MultiThreadedCertVerifier is a CertVerifier implementation that runs |
31 // synchronous CertVerifier implementations on worker threads. | 31 // synchronous CertVerifier implementations on worker threads. |
32 class NET_EXPORT_PRIVATE MultiThreadedCertVerifier | 32 class NET_EXPORT_PRIVATE MultiThreadedCertVerifier : public CertVerifier { |
33 : public CertVerifier, | |
34 NON_EXPORTED_BASE(public base::NonThreadSafe) { | |
35 public: | 33 public: |
36 explicit MultiThreadedCertVerifier(CertVerifyProc* verify_proc); | 34 explicit MultiThreadedCertVerifier(CertVerifyProc* verify_proc); |
37 | 35 |
38 // When the verifier is destroyed, all certificate verifications requests are | 36 // When the verifier is destroyed, all certificate verifications requests are |
39 // canceled, and their completion callbacks will not be called. | 37 // canceled, and their completion callbacks will not be called. |
40 ~MultiThreadedCertVerifier() override; | 38 ~MultiThreadedCertVerifier() override; |
41 | 39 |
42 // CertVerifier implementation | 40 // CertVerifier implementation |
43 int Verify(const RequestParams& params, | 41 int Verify(const RequestParams& params, |
44 CRLSet* crl_set, | 42 CRLSet* crl_set, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // set<unique_ptr> but extraction of owned objects from a set of owned types | 78 // set<unique_ptr> but extraction of owned objects from a set of owned types |
81 // doesn't come until C++17. | 79 // doesn't come until C++17. |
82 std::map<CertVerifierJob*, std::unique_ptr<CertVerifierJob>, JobComparator> | 80 std::map<CertVerifierJob*, std::unique_ptr<CertVerifierJob>, JobComparator> |
83 inflight_; | 81 inflight_; |
84 | 82 |
85 uint64_t requests_; | 83 uint64_t requests_; |
86 uint64_t inflight_joins_; | 84 uint64_t inflight_joins_; |
87 | 85 |
88 scoped_refptr<CertVerifyProc> verify_proc_; | 86 scoped_refptr<CertVerifyProc> verify_proc_; |
89 | 87 |
| 88 THREAD_CHECKER(thread_checker_); |
| 89 |
90 DISALLOW_COPY_AND_ASSIGN(MultiThreadedCertVerifier); | 90 DISALLOW_COPY_AND_ASSIGN(MultiThreadedCertVerifier); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace net | 93 } // namespace net |
94 | 94 |
95 #endif // NET_CERT_MULTI_THREADED_CERT_VERIFIER_H_ | 95 #endif // NET_CERT_MULTI_THREADED_CERT_VERIFIER_H_ |
OLD | NEW |