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

Side by Side Diff: net/socket/nss_ssl_util.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/socket/dns_cert_provenance_checker.cc ('k') | net/socket/ssl_client_socket_mac.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/socket/nss_ssl_util.h" 5 #include "net/socket/nss_ssl_util.h"
6 6
7 #include <nss.h> 7 #include <nss.h>
8 #include <secerr.h> 8 #include <secerr.h>
9 #include <ssl.h> 9 #include <ssl.h>
10 #include <sslerr.h> 10 #include <sslerr.h>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // All other SSL options are set per-session by SSLClientSocket and 62 // All other SSL options are set per-session by SSLClientSocket and
63 // SSLServerSocket. 63 // SSLServerSocket.
64 } 64 }
65 65
66 ~NSSSSLInitSingleton() { 66 ~NSSSSLInitSingleton() {
67 // Have to clear the cache, or NSS_Shutdown fails with SEC_ERROR_BUSY. 67 // Have to clear the cache, or NSS_Shutdown fails with SEC_ERROR_BUSY.
68 SSL_ClearSessionCache(); 68 SSL_ClearSessionCache();
69 } 69 }
70 }; 70 };
71 71
72 static base::LazyInstance<NSSSSLInitSingleton> g_nss_ssl_init_singleton( 72 static base::LazyInstance<NSSSSLInitSingleton> g_nss_ssl_init_singleton =
73 base::LINKER_INITIALIZED); 73 LAZY_INSTANCE_INITIALIZER;
74 74
75 // Initialize the NSS SSL library if it isn't already initialized. This must 75 // Initialize the NSS SSL library if it isn't already initialized. This must
76 // be called before any other NSS SSL functions. This function is 76 // be called before any other NSS SSL functions. This function is
77 // thread-safe, and the NSS SSL library will only ever be initialized once. 77 // thread-safe, and the NSS SSL library will only ever be initialized once.
78 // The NSS SSL library will be properly shut down on program exit. 78 // The NSS SSL library will be properly shut down on program exit.
79 void EnsureNSSSSLInit() { 79 void EnsureNSSSSLInit() {
80 // Initializing SSL causes us to do blocking IO. 80 // Initializing SSL causes us to do blocking IO.
81 // Temporarily allow it until we fix 81 // Temporarily allow it until we fix
82 // http://code.google.com/p/chromium/issues/detail?id=59847 82 // http://code.google.com/p/chromium/issues/detail?id=59847
83 base::ThreadRestrictions::ScopedAllowIO allow_io; 83 base::ThreadRestrictions::ScopedAllowIO allow_io;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 void LogFailedNSSFunction(const BoundNetLog& net_log, 258 void LogFailedNSSFunction(const BoundNetLog& net_log,
259 const char* function, 259 const char* function,
260 const char* param) { 260 const char* param) {
261 net_log.AddEvent( 261 net_log.AddEvent(
262 NetLog::TYPE_SSL_NSS_ERROR, 262 NetLog::TYPE_SSL_NSS_ERROR,
263 make_scoped_refptr(new SSLFailedNSSFunctionParams(function, param))); 263 make_scoped_refptr(new SSLFailedNSSFunctionParams(function, param)));
264 } 264 }
265 265
266 } // namespace net 266 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/dns_cert_provenance_checker.cc ('k') | net/socket/ssl_client_socket_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698