OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ocsp/nss_ocsp.h" | 5 #include "net/ocsp/nss_ocsp.h" |
6 | 6 |
7 #include <certt.h> | 7 #include <certt.h> |
8 #include <certdb.h> | 8 #include <certdb.h> |
9 #include <ocsp.h> | 9 #include <ocsp.h> |
10 #include <nspr.h> | 10 #include <nspr.h> |
11 #include <nss.h> | 11 #include <nss.h> |
12 #include <pthread.h> | 12 #include <pthread.h> |
13 #include <secerr.h> | 13 #include <secerr.h> |
14 | 14 |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
18 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
19 #include "base/condition_variable.h" | 19 #include "base/condition_variable.h" |
20 #include "base/lazy_instance.h" | 20 #include "base/lazy_instance.h" |
21 #include "base/lock.h" | 21 #include "base/lock.h" |
22 #include "base/logging.h" | 22 #include "base/logging.h" |
23 #include "base/message_loop.h" | 23 #include "base/message_loop.h" |
24 #include "base/metrics/histogram.h" | 24 #include "base/metrics/histogram.h" |
25 #include "base/stl_util-inl.h" | 25 #include "base/stl_util-inl.h" |
26 #include "base/string_util.h" | 26 #include "base/string_util.h" |
27 #include "base/stringprintf.h" | 27 #include "base/stringprintf.h" |
28 #include "base/thread_checker.h" | 28 #include "base/threading/thread_checker.h" |
29 #include "base/time.h" | 29 #include "base/time.h" |
30 #include "googleurl/src/gurl.h" | 30 #include "googleurl/src/gurl.h" |
31 #include "net/base/io_buffer.h" | 31 #include "net/base/io_buffer.h" |
32 #include "net/base/load_flags.h" | 32 #include "net/base/load_flags.h" |
33 #include "net/http/http_request_headers.h" | 33 #include "net/http/http_request_headers.h" |
34 #include "net/http/http_response_headers.h" | 34 #include "net/http/http_response_headers.h" |
35 #include "net/url_request/url_request.h" | 35 #include "net/url_request/url_request.h" |
36 #include "net/url_request/url_request_context.h" | 36 #include "net/url_request/url_request_context.h" |
37 | 37 |
38 namespace { | 38 namespace { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 ~OCSPIOLoop(); | 73 ~OCSPIOLoop(); |
74 | 74 |
75 void CancelAllRequests(); | 75 void CancelAllRequests(); |
76 | 76 |
77 mutable Lock lock_; | 77 mutable Lock lock_; |
78 bool shutdown_; // Protected by |lock_|. | 78 bool shutdown_; // Protected by |lock_|. |
79 std::set<OCSPRequestSession*> requests_; // Protected by |lock_|. | 79 std::set<OCSPRequestSession*> requests_; // Protected by |lock_|. |
80 bool used_; // Protected by |lock_|. | 80 bool used_; // Protected by |lock_|. |
81 // This should not be modified after |used_|. | 81 // This should not be modified after |used_|. |
82 MessageLoopForIO* io_loop_; // Protected by |lock_|. | 82 MessageLoopForIO* io_loop_; // Protected by |lock_|. |
83 ThreadChecker thread_checker_; | 83 base::ThreadChecker thread_checker_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(OCSPIOLoop); | 85 DISALLOW_COPY_AND_ASSIGN(OCSPIOLoop); |
86 }; | 86 }; |
87 | 87 |
88 base::LazyInstance<OCSPIOLoop, base::LeakyLazyInstanceTraits<OCSPIOLoop> > | 88 base::LazyInstance<OCSPIOLoop, base::LeakyLazyInstanceTraits<OCSPIOLoop> > |
89 g_ocsp_io_loop(base::LINKER_INITIALIZED); | 89 g_ocsp_io_loop(base::LINKER_INITIALIZED); |
90 | 90 |
91 const int kRecvBufferSize = 4096; | 91 const int kRecvBufferSize = 4096; |
92 | 92 |
93 // All OCSP handlers should be called in the context of | 93 // All OCSP handlers should be called in the context of |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 | 909 |
910 URLRequestContext* GetURLRequestContextForOCSP() { | 910 URLRequestContext* GetURLRequestContextForOCSP() { |
911 pthread_mutex_lock(&g_request_context_lock); | 911 pthread_mutex_lock(&g_request_context_lock); |
912 URLRequestContext* request_context = g_request_context; | 912 URLRequestContext* request_context = g_request_context; |
913 pthread_mutex_unlock(&g_request_context_lock); | 913 pthread_mutex_unlock(&g_request_context_lock); |
914 DCHECK(!request_context || request_context->is_main()); | 914 DCHECK(!request_context || request_context->is_main()); |
915 return request_context; | 915 return request_context; |
916 } | 916 } |
917 | 917 |
918 } // namespace net | 918 } // namespace net |
OLD | NEW |