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

Side by Side Diff: crypto/openssl_util.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 months 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
« no previous file with comments | « crypto/mac_security_services_lock.cc ('k') | device/battery/battery_status_service.h » ('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 "crypto/openssl_util.h" 5 #include "crypto/openssl_util.h"
6 6
7 #include <openssl/err.h> 7 #include <openssl/err.h>
8 #include <openssl/ssl.h> 8 #include <openssl/ssl.h>
9 #include <openssl/cpu.h> 9 #include <openssl/cpu.h>
10 10
(...skipping 17 matching lines...) Expand all
28 static OpenSSLInitSingleton* GetInstance() { 28 static OpenSSLInitSingleton* GetInstance() {
29 // We allow the SSL environment to leak for multiple reasons: 29 // We allow the SSL environment to leak for multiple reasons:
30 // - it is used from a non-joinable worker thread that is not stopped on 30 // - it is used from a non-joinable worker thread that is not stopped on
31 // shutdown, hence may still be using OpenSSL library after the AtExit 31 // shutdown, hence may still be using OpenSSL library after the AtExit
32 // runner has completed. 32 // runner has completed.
33 // - There are other OpenSSL related singletons (e.g. the client socket 33 // - There are other OpenSSL related singletons (e.g. the client socket
34 // context) who's cleanup depends on the global environment here, but 34 // context) who's cleanup depends on the global environment here, but
35 // we can't control the order the AtExit handlers will run in so 35 // we can't control the order the AtExit handlers will run in so
36 // allowing the global environment to leak at least ensures it is 36 // allowing the global environment to leak at least ensures it is
37 // available for those other singletons to reliably cleanup. 37 // available for those other singletons to reliably cleanup.
38 return Singleton<OpenSSLInitSingleton, 38 return base::Singleton<
39 LeakySingletonTraits<OpenSSLInitSingleton> >::get(); 39 OpenSSLInitSingleton,
40 base::LeakySingletonTraits<OpenSSLInitSingleton>>::get();
40 } 41 }
41 private: 42 private:
42 friend struct DefaultSingletonTraits<OpenSSLInitSingleton>; 43 friend struct base::DefaultSingletonTraits<OpenSSLInitSingleton>;
43 OpenSSLInitSingleton() { 44 OpenSSLInitSingleton() {
44 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) 45 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL)
45 const bool has_neon = 46 const bool has_neon =
46 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; 47 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0;
47 // CRYPTO_set_NEON_capable is called before |SSL_library_init| because this 48 // CRYPTO_set_NEON_capable is called before |SSL_library_init| because this
48 // stops BoringSSL from probing for NEON support via SIGILL in the case 49 // stops BoringSSL from probing for NEON support via SIGILL in the case
49 // that getauxval isn't present. 50 // that getauxval isn't present.
50 CRYPTO_set_NEON_capable(has_neon); 51 CRYPTO_set_NEON_capable(has_neon);
51 // See https://code.google.com/p/chromium/issues/detail?id=341598 52 // See https://code.google.com/p/chromium/issues/detail?id=341598
52 base::CPU cpu; 53 base::CPU cpu;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 std::string message; 91 std::string message;
91 location.Write(true, true, &message); 92 location.Write(true, true, &message);
92 DVLOG(1) << "OpenSSL ERR_get_error stack from " << message; 93 DVLOG(1) << "OpenSSL ERR_get_error stack from " << message;
93 ERR_print_errors_cb(&OpenSSLErrorCallback, NULL); 94 ERR_print_errors_cb(&OpenSSLErrorCallback, NULL);
94 } else { 95 } else {
95 ERR_clear_error(); 96 ERR_clear_error();
96 } 97 }
97 } 98 }
98 99
99 } // namespace crypto 100 } // namespace crypto
OLDNEW
« no previous file with comments | « crypto/mac_security_services_lock.cc ('k') | device/battery/battery_status_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698