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