summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorjoth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-19 17:58:00 +0000
committerjoth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-19 17:58:00 +0000
commit908e0805e70c87a898f536efa92ef2d76e41fd6d (patch)
tree04957f305583658eff6948d8a365c4fa72631c6c /base
parenta8099142a1a8b4fee2136669eb7ab41868e4e7a0 (diff)
downloadchromium_src-908e0805e70c87a898f536efa92ef2d76e41fd6d.zip
chromium_src-908e0805e70c87a898f536efa92ef2d76e41fd6d.tar.gz
chromium_src-908e0805e70c87a898f536efa92ef2d76e41fd6d.tar.bz2
Fix openssl build to work with AllowSingleton changes
BUG=61585 TEST=net & base unit tests; start & quit browser Review URL: http://codereview.chromium.org/5102006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66772 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/openssl_util.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/base/openssl_util.cc b/base/openssl_util.cc
index 1cbc304..5cfc34a 100644
--- a/base/openssl_util.cc
+++ b/base/openssl_util.cc
@@ -22,6 +22,20 @@ unsigned long CurrentThreadId() {
// Singleton for initializing and cleaning up the OpenSSL library.
class OpenSSLInitSingleton {
+ public:
+ static OpenSSLInitSingleton* Get() {
+ // We allow the SSL environment to leak for multiple reasons:
+ // - it is used from a non-joinable worker thread that is not stopped on
+ // shutdown, hence may still be using OpenSSL library after the AtExit
+ // runner has completed.
+ // - There are other OpenSSL related singletons (e.g. the client socket
+ // context) who's cleanup depends on the global environment here, but
+ // we can't control the order the AtExit handlers will run in so
+ // allowing the global environment to leak at least ensures it is
+ // available for those other singletons to reliably cleanup.
+ return Singleton<OpenSSLInitSingleton,
+ LeakySingletonTraits<OpenSSLInitSingleton> >::get();
+ }
private:
friend struct DefaultSingletonTraits<OpenSSLInitSingleton>;
OpenSSLInitSingleton() {
@@ -43,8 +57,7 @@ class OpenSSLInitSingleton {
}
static void LockingCallback(int mode, int n, const char* file, int line) {
- Singleton<OpenSSLInitSingleton>::get()->OnLockingCallback(mode, n, file,
- line);
+ OpenSSLInitSingleton::Get()->OnLockingCallback(mode, n, file, line);
}
void OnLockingCallback(int mode, int n, const char* file, int line) {
@@ -64,7 +77,7 @@ class OpenSSLInitSingleton {
} // namespace
void EnsureOpenSSLInit() {
- (void)Singleton<OpenSSLInitSingleton>::get();
+ (void)OpenSSLInitSingleton::Get();
}
void ClearOpenSSLERRStack(const tracked_objects::Location& location) {