| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "base/values.h" | 23 #include "base/values.h" |
| 24 #include "net/base/hash_value.h" | 24 #include "net/base/hash_value.h" |
| 25 #include "net/base/net_errors.h" | 25 #include "net/base/net_errors.h" |
| 26 #include "net/cert/cert_trust_anchor_provider.h" | 26 #include "net/cert/cert_trust_anchor_provider.h" |
| 27 #include "net/cert/cert_verify_proc.h" | 27 #include "net/cert/cert_verify_proc.h" |
| 28 #include "net/cert/crl_set.h" | 28 #include "net/cert/crl_set.h" |
| 29 #include "net/cert/x509_certificate.h" | 29 #include "net/cert/x509_certificate.h" |
| 30 #include "net/cert/x509_certificate_net_log_param.h" | 30 #include "net/cert/x509_certificate_net_log_param.h" |
| 31 #include "net/log/net_log.h" | 31 #include "net/log/net_log.h" |
| 32 | 32 |
| 33 #if defined(USE_NSS_VERIFIER) | 33 #if defined(USE_NSS_CERTS) |
| 34 #include <private/pprthred.h> // PR_DetachThread | 34 #include <private/pprthred.h> // PR_DetachThread |
| 35 #endif | 35 #endif |
| 36 | 36 |
| 37 namespace net { | 37 namespace net { |
| 38 | 38 |
| 39 //////////////////////////////////////////////////////////////////////////// | 39 //////////////////////////////////////////////////////////////////////////// |
| 40 // | 40 // |
| 41 // MultiThreadedCertVerifier is a thread-unsafe object which lives, dies, and is | 41 // MultiThreadedCertVerifier is a thread-unsafe object which lives, dies, and is |
| 42 // operated on a single thread, henceforth referred to as the "origin" thread. | 42 // operated on a single thread, henceforth referred to as the "origin" thread. |
| 43 // | 43 // |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 const std::string& ocsp_response, | 232 const std::string& ocsp_response, |
| 233 int flags, | 233 int flags, |
| 234 const scoped_refptr<CRLSet>& crl_set, | 234 const scoped_refptr<CRLSet>& crl_set, |
| 235 const CertificateList& additional_trust_anchors, | 235 const CertificateList& additional_trust_anchors, |
| 236 int* error, | 236 int* error, |
| 237 CertVerifyResult* result) { | 237 CertVerifyResult* result) { |
| 238 TRACE_EVENT0("net", "DoVerifyOnWorkerThread"); | 238 TRACE_EVENT0("net", "DoVerifyOnWorkerThread"); |
| 239 *error = verify_proc->Verify(cert.get(), hostname, ocsp_response, flags, | 239 *error = verify_proc->Verify(cert.get(), hostname, ocsp_response, flags, |
| 240 crl_set.get(), additional_trust_anchors, result); | 240 crl_set.get(), additional_trust_anchors, result); |
| 241 | 241 |
| 242 #if defined(USE_NSS_VERIFIER) | 242 #if defined(USE_NSS_CERTS) |
| 243 // Detach the thread from NSPR. | 243 // Detach the thread from NSPR. |
| 244 // Calling NSS functions attaches the thread to NSPR, which stores | 244 // Calling NSS functions attaches the thread to NSPR, which stores |
| 245 // the NSPR thread ID in thread-specific data. | 245 // the NSPR thread ID in thread-specific data. |
| 246 // The threads in our thread pool terminate after we have called | 246 // The threads in our thread pool terminate after we have called |
| 247 // PR_Cleanup. Unless we detach them from NSPR, net_unittests gets | 247 // PR_Cleanup. Unless we detach them from NSPR, net_unittests gets |
| 248 // segfaults on shutdown when the threads' thread-specific data | 248 // segfaults on shutdown when the threads' thread-specific data |
| 249 // destructors run. | 249 // destructors run. |
| 250 PR_DetachThread(); | 250 PR_DetachThread(); |
| 251 #endif | 251 #endif |
| 252 } | 252 } |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 // The JobSet is kept in sorted order so items can be found using binary | 587 // The JobSet is kept in sorted order so items can be found using binary |
| 588 // search. | 588 // search. |
| 589 auto it = std::lower_bound(inflight_.begin(), inflight_.end(), key, | 589 auto it = std::lower_bound(inflight_.begin(), inflight_.end(), key, |
| 590 JobToRequestParamsComparator()); | 590 JobToRequestParamsComparator()); |
| 591 if (it != inflight_.end() && !(key < (*it)->key())) | 591 if (it != inflight_.end() && !(key < (*it)->key())) |
| 592 return *it; | 592 return *it; |
| 593 return nullptr; | 593 return nullptr; |
| 594 } | 594 } |
| 595 | 595 |
| 596 } // namespace net | 596 } // namespace net |
| OLD | NEW |