Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: net/base/multi_threaded_cert_verifier.h

Issue 10917309: Make MultiThreadedCertVerifier receive a CertVerifyProc, rather than creating one (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_BASE_MULTI_THREADED_CERT_VERIFIER_H_ 5 #ifndef NET_BASE_MULTI_THREADED_CERT_VERIFIER_H_
6 #define NET_BASE_MULTI_THREADED_CERT_VERIFIER_H_ 6 #define NET_BASE_MULTI_THREADED_CERT_VERIFIER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 16 matching lines...) Expand all
27 class CertVerifierWorker; 27 class CertVerifierWorker;
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
33 : public CertVerifier, 33 : public CertVerifier,
34 NON_EXPORTED_BASE(public base::NonThreadSafe), 34 NON_EXPORTED_BASE(public base::NonThreadSafe),
35 public CertDatabase::Observer { 35 public CertDatabase::Observer {
36 public: 36 public:
37 MultiThreadedCertVerifier(); 37 explicit MultiThreadedCertVerifier(CertVerifyProc* verify_proc);
38 38
39 // When the verifier is destroyed, all certificate verifications requests are 39 // When the verifier is destroyed, all certificate verifications requests are
40 // canceled, and their completion callbacks will not be called. 40 // canceled, and their completion callbacks will not be called.
41 virtual ~MultiThreadedCertVerifier(); 41 virtual ~MultiThreadedCertVerifier();
42 42
43 // CertVerifier implementation 43 // CertVerifier implementation
44 virtual int Verify(X509Certificate* cert, 44 virtual int Verify(X509Certificate* cert,
45 const std::string& hostname, 45 const std::string& hostname,
46 int flags, 46 int flags,
47 CRLSet* crl_set, 47 CRLSet* crl_set,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 // CertDatabase::Observer methods: 137 // CertDatabase::Observer methods:
138 virtual void OnCertTrustChanged(const X509Certificate* cert) OVERRIDE; 138 virtual void OnCertTrustChanged(const X509Certificate* cert) OVERRIDE;
139 139
140 // For unit testing. 140 // For unit testing.
141 void ClearCache() { cache_.Clear(); } 141 void ClearCache() { cache_.Clear(); }
142 size_t GetCacheSize() const { return cache_.size(); } 142 size_t GetCacheSize() const { return cache_.size(); }
143 uint64 cache_hits() const { return cache_hits_; } 143 uint64 cache_hits() const { return cache_hits_; }
144 uint64 requests() const { return requests_; } 144 uint64 requests() const { return requests_; }
145 uint64 inflight_joins() const { return inflight_joins_; } 145 uint64 inflight_joins() const { return inflight_joins_; }
146 void SetCertVerifyProc(CertVerifyProc* verify_proc);
147 146
148 // cache_ maps from a request to a cached result. 147 // cache_ maps from a request to a cached result.
149 CertVerifierCache cache_; 148 CertVerifierCache cache_;
150 149
151 // inflight_ maps from a request to an active verification which is taking 150 // inflight_ maps from a request to an active verification which is taking
152 // place. 151 // place.
153 std::map<RequestParams, CertVerifierJob*> inflight_; 152 std::map<RequestParams, CertVerifierJob*> inflight_;
154 153
155 uint64 requests_; 154 uint64 requests_;
156 uint64 cache_hits_; 155 uint64 cache_hits_;
157 uint64 inflight_joins_; 156 uint64 inflight_joins_;
158 157
159 scoped_refptr<CertVerifyProc> verify_proc_; 158 scoped_refptr<CertVerifyProc> verify_proc_;
160 159
161 DISALLOW_COPY_AND_ASSIGN(MultiThreadedCertVerifier); 160 DISALLOW_COPY_AND_ASSIGN(MultiThreadedCertVerifier);
162 }; 161 };
163 162
164 } // namespace net 163 } // namespace net
165 164
166 #endif // NET_BASE_MULTI_THREADED_CERT_VERIFIER_H_ 165 #endif // NET_BASE_MULTI_THREADED_CERT_VERIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698