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