OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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/base/cert_verifier.h" | 5 #include "net/base/cert_verifier.h" |
6 | 6 |
7 #if defined(OS_LINUX) | 7 #if defined(USE_NSS) |
8 #include <private/pprthred.h> // PR_DetatchThread | 8 #include <private/pprthred.h> // PR_DetatchThread |
9 #endif | 9 #endif |
10 | 10 |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/worker_pool.h" | 12 #include "base/worker_pool.h" |
13 #include "net/base/cert_verify_result.h" | 13 #include "net/base/cert_verify_result.h" |
14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
15 #include "net/base/x509_certificate.h" | 15 #include "net/base/x509_certificate.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
(...skipping 13 matching lines...) Expand all Loading... |
31 verifier_(verifier), | 31 verifier_(verifier), |
32 verify_result_(verify_result), | 32 verify_result_(verify_result), |
33 callback_(callback), | 33 callback_(callback), |
34 origin_loop_(MessageLoop::current()), | 34 origin_loop_(MessageLoop::current()), |
35 error_(OK) { | 35 error_(OK) { |
36 } | 36 } |
37 | 37 |
38 void DoVerify() { | 38 void DoVerify() { |
39 // Running on the worker thread | 39 // Running on the worker thread |
40 error_ = cert_->Verify(hostname_, flags_, &result_); | 40 error_ = cert_->Verify(hostname_, flags_, &result_); |
41 #if defined(OS_LINUX) | 41 #if defined(USE_NSS) |
42 // Detach the thread from NSPR. | 42 // Detach the thread from NSPR. |
43 // Calling NSS functions attaches the thread to NSPR, which stores | 43 // Calling NSS functions attaches the thread to NSPR, which stores |
44 // the NSPR thread ID in thread-specific data. | 44 // the NSPR thread ID in thread-specific data. |
45 // The threads in our thread pool terminate after we have called | 45 // The threads in our thread pool terminate after we have called |
46 // PR_Cleanup. Unless we detach them from NSPR, net_unittests gets | 46 // PR_Cleanup. Unless we detach them from NSPR, net_unittests gets |
47 // segfaults on shutdown when the threads' thread-specific data | 47 // segfaults on shutdown when the threads' thread-specific data |
48 // destructors run. | 48 // destructors run. |
49 PR_DetachThread(); | 49 PR_DetachThread(); |
50 #endif | 50 #endif |
51 | 51 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 NewRunnableMethod(request_.get(), &Request::DoVerify), true)) { | 146 NewRunnableMethod(request_.get(), &Request::DoVerify), true)) { |
147 NOTREACHED(); | 147 NOTREACHED(); |
148 request_ = NULL; | 148 request_ = NULL; |
149 return ERR_FAILED; | 149 return ERR_FAILED; |
150 } | 150 } |
151 | 151 |
152 return ERR_IO_PENDING; | 152 return ERR_IO_PENDING; |
153 } | 153 } |
154 | 154 |
155 } // namespace net | 155 } // namespace net |
OLD | NEW |