Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: net/ocsp/nss_ocsp.cc

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: willchan comments + rebase Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/file_win.cc ('k') | net/proxy/dhcpcsvc_init_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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>
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 base::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 = LAZY_INSTANCE_INITIALIZER;
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
94 // CertVerifier's thread (i.e. worker pool, not on the I/O thread). 94 // CertVerifier's thread (i.e. worker pool, not on the I/O thread).
95 // It supports blocking mode only. 95 // It supports blocking mode only.
96 96
97 SECStatus OCSPCreateSession(const char* host, PRUint16 portnum, 97 SECStatus OCSPCreateSession(const char* host, PRUint16 portnum,
98 SEC_HTTP_SERVER_SESSION* pSession); 98 SEC_HTTP_SERVER_SESSION* pSession);
99 SECStatus OCSPKeepAliveSession(SEC_HTTP_SERVER_SESSION session, 99 SECStatus OCSPKeepAliveSession(SEC_HTTP_SERVER_SESSION session,
(...skipping 29 matching lines...) Expand all
129 friend struct base::DefaultLazyInstanceTraits<OCSPNSSInitialization>; 129 friend struct base::DefaultLazyInstanceTraits<OCSPNSSInitialization>;
130 130
131 OCSPNSSInitialization(); 131 OCSPNSSInitialization();
132 ~OCSPNSSInitialization(); 132 ~OCSPNSSInitialization();
133 133
134 SEC_HttpClientFcn client_fcn_; 134 SEC_HttpClientFcn client_fcn_;
135 135
136 DISALLOW_COPY_AND_ASSIGN(OCSPNSSInitialization); 136 DISALLOW_COPY_AND_ASSIGN(OCSPNSSInitialization);
137 }; 137 };
138 138
139 base::LazyInstance<OCSPNSSInitialization> g_ocsp_nss_initialization( 139 base::LazyInstance<OCSPNSSInitialization> g_ocsp_nss_initialization =
140 base::LINKER_INITIALIZED); 140 LAZY_INSTANCE_INITIALIZER;
141 141
142 // Concrete class for SEC_HTTP_REQUEST_SESSION. 142 // Concrete class for SEC_HTTP_REQUEST_SESSION.
143 // Public methods except virtual methods of net::URLRequest::Delegate 143 // Public methods except virtual methods of net::URLRequest::Delegate
144 // (On* methods) run on certificate verifier thread (worker thread). 144 // (On* methods) run on certificate verifier thread (worker thread).
145 // Virtual methods of net::URLRequest::Delegate and private methods run 145 // Virtual methods of net::URLRequest::Delegate and private methods run
146 // on IO thread. 146 // on IO thread.
147 class OCSPRequestSession 147 class OCSPRequestSession
148 : public base::RefCountedThreadSafe<OCSPRequestSession>, 148 : public base::RefCountedThreadSafe<OCSPRequestSession>,
149 public net::URLRequest::Delegate { 149 public net::URLRequest::Delegate {
150 public: 150 public:
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 void SetURLRequestContextForOCSP(URLRequestContext* request_context) { 931 void SetURLRequestContextForOCSP(URLRequestContext* request_context) {
932 pthread_mutex_lock(&g_request_context_lock); 932 pthread_mutex_lock(&g_request_context_lock);
933 if (request_context) { 933 if (request_context) {
934 DCHECK(!g_request_context); 934 DCHECK(!g_request_context);
935 } 935 }
936 g_request_context = request_context; 936 g_request_context = request_context;
937 pthread_mutex_unlock(&g_request_context_lock); 937 pthread_mutex_unlock(&g_request_context_lock);
938 } 938 }
939 939
940 } // namespace net 940 } // namespace net
OLDNEW
« no previous file with comments | « net/disk_cache/file_win.cc ('k') | net/proxy/dhcpcsvc_init_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698