Index: net/base/multi_threaded_cert_verifier.h |
diff --git a/net/base/multi_threaded_cert_verifier.h b/net/base/multi_threaded_cert_verifier.h |
index 78f372ea34a5267eaddd9c8feb1f56000e7c0098..fbd385892a9057988d71d68be024477e213b2b9f 100644 |
--- a/net/base/multi_threaded_cert_verifier.h |
+++ b/net/base/multi_threaded_cert_verifier.h |
@@ -11,6 +11,7 @@ |
#include "base/basictypes.h" |
#include "base/gtest_prod_util.h" |
+#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/threading/non_thread_safe.h" |
#include "net/base/cert_database.h" |
@@ -25,12 +26,38 @@ namespace net { |
// MultiThreadedCertVerifier is a CertVerifier implementation that runs |
// synchronous CertVerifier implementations on worker threads. |
-class NET_EXPORT MultiThreadedCertVerifier : |
+class MultiThreadedCertVerifier : |
public CertVerifier, |
NON_EXPORTED_BASE(public base::NonThreadSafe), |
public CertDatabase::Observer { |
public: |
- MultiThreadedCertVerifier(); |
+ // Class to perform the actual certificate validation on a worker thread. |
+ // This class MUST be thread-safe, as it will be called concurrently on |
+ // multiple worker threads. |
+ // Note: Because these worker threads run within a worker pool, VerifyProc |
+ // implementations must be careful about using other objects, such as |
+ // MessageLoops, Singletons, etc, as these objects may no longer exist |
+ // during shutdown. |
+ class VerifyProc : public base::RefCountedThreadSafe<VerifyProc> { |
+ public: |
+ // Performs a synchronous verification of |cert| for the specified |
+ // |hostname|. |
+ // The arguments mirror those of CertVerifier::Verify(). |
+ // Note: Multiple calls to Verify() may be running in parallel, so |
+ // any state inside of |this| should not mutate. |
+ virtual int Verify(X509Certificate* cert, |
+ const std::string& hostname, |
+ int flags, |
+ CRLSet* crl_set, |
+ CertVerifyResult* verify_result) = 0; |
+ |
+ protected: |
+ friend class base::RefCountedThreadSafe<VerifyProc>; |
+ |
+ virtual ~VerifyProc() {} |
+ }; |
+ |
+ explicit MultiThreadedCertVerifier(VerifyProc* verifier); |
// When the verifier is destroyed, all certificate verifications requests are |
// canceled, and their completion callbacks will not be called. |
@@ -126,6 +153,8 @@ class NET_EXPORT MultiThreadedCertVerifier : |
// place. |
std::map<RequestParams, CertVerifierJob*> inflight_; |
+ scoped_refptr<VerifyProc> verifier_; |
+ |
uint64 requests_; |
uint64 cache_hits_; |
uint64 inflight_joins_; |