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 #include "net/cert/multi_threaded_cert_verifier.h" | 5 #include "net/cert/multi_threaded_cert_verifier.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/profiler/scoped_tracker.h" | 14 #include "base/profiler/scoped_tracker.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
17 #include "base/threading/worker_pool.h" | 17 #include "base/threading/worker_pool.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "net/base/hash_value.h" | 20 #include "net/base/hash_value.h" |
21 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
22 #include "net/cert/cert_trust_anchor_provider.h" | 22 #include "net/cert/cert_trust_anchor_provider.h" |
23 #include "net/cert/cert_verify_proc.h" | 23 #include "net/cert/cert_verify_proc.h" |
24 #include "net/cert/crl_set.h" | 24 #include "net/cert/crl_set.h" |
25 #include "net/cert/x509_certificate.h" | 25 #include "net/cert/x509_certificate.h" |
26 #include "net/cert/x509_certificate_net_log_param.h" | 26 #include "net/cert/x509_certificate_net_log_param.h" |
27 #include "net/log/net_log.h" | 27 #include "net/log/net_log.h" |
28 | 28 |
29 #if defined(USE_NSS) || defined(OS_IOS) | 29 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
30 #include <private/pprthred.h> // PR_DetachThread | 30 #include <private/pprthred.h> // PR_DetachThread |
31 #endif | 31 #endif |
32 | 32 |
33 namespace net { | 33 namespace net { |
34 | 34 |
35 //////////////////////////////////////////////////////////////////////////// | 35 //////////////////////////////////////////////////////////////////////////// |
36 | 36 |
37 // Life of a request: | 37 // Life of a request: |
38 // | 38 // |
39 // MultiThreadedCertVerifier CertVerifierJob CertVerifierWorker Request | 39 // MultiThreadedCertVerifier CertVerifierJob CertVerifierWorker Request |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 256 |
257 private: | 257 private: |
258 void Run() { | 258 void Run() { |
259 // Runs on a worker thread. | 259 // Runs on a worker thread. |
260 error_ = verify_proc_->Verify(cert_.get(), | 260 error_ = verify_proc_->Verify(cert_.get(), |
261 hostname_, | 261 hostname_, |
262 flags_, | 262 flags_, |
263 crl_set_.get(), | 263 crl_set_.get(), |
264 additional_trust_anchors_, | 264 additional_trust_anchors_, |
265 &verify_result_); | 265 &verify_result_); |
266 #if defined(USE_NSS) || defined(OS_IOS) | 266 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
267 // Detach the thread from NSPR. | 267 // Detach the thread from NSPR. |
268 // Calling NSS functions attaches the thread to NSPR, which stores | 268 // Calling NSS functions attaches the thread to NSPR, which stores |
269 // the NSPR thread ID in thread-specific data. | 269 // the NSPR thread ID in thread-specific data. |
270 // The threads in our thread pool terminate after we have called | 270 // The threads in our thread pool terminate after we have called |
271 // PR_Cleanup. Unless we detach them from NSPR, net_unittests gets | 271 // PR_Cleanup. Unless we detach them from NSPR, net_unittests gets |
272 // segfaults on shutdown when the threads' thread-specific data | 272 // segfaults on shutdown when the threads' thread-specific data |
273 // destructors run. | 273 // destructors run. |
274 PR_DetachThread(); | 274 PR_DetachThread(); |
275 #endif | 275 #endif |
276 Finish(); | 276 Finish(); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 | 615 |
616 void MultiThreadedCertVerifier::OnCACertChanged( | 616 void MultiThreadedCertVerifier::OnCACertChanged( |
617 const X509Certificate* cert) { | 617 const X509Certificate* cert) { |
618 DCHECK(CalledOnValidThread()); | 618 DCHECK(CalledOnValidThread()); |
619 | 619 |
620 ClearCache(); | 620 ClearCache(); |
621 } | 621 } |
622 | 622 |
623 } // namespace net | 623 } // namespace net |
624 | 624 |
OLD | NEW |