diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-19 19:17:08 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-19 19:17:08 +0000 |
commit | ee432ee0a565736be395b8729bc811212fd88bf3 (patch) | |
tree | 4922e685fc7e392d3b67029d4a821adc9d323f1a /net/base/x509_certificate_mac.cc | |
parent | 1d14ba55e2472ad65b41423a6b8ed13b32dc206d (diff) | |
download | chromium_src-ee432ee0a565736be395b8729bc811212fd88bf3.zip chromium_src-ee432ee0a565736be395b8729bc811212fd88bf3.tar.gz chromium_src-ee432ee0a565736be395b8729bc811212fd88bf3.tar.bz2 |
Revert 66719 - Reland r65996. Disallows Singletons on non-joinable thread.
Test breakages caused by this change have been fixed here or in other changelists.
BUG=61753
TEST=none
Review URL: http://codereview.chromium.org/5024003
TBR=willchan@chromium.org
Review URL: http://codereview.chromium.org/5206005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66791 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/x509_certificate_mac.cc')
-rw-r--r-- | net/base/x509_certificate_mac.cc | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/net/base/x509_certificate_mac.cc b/net/base/x509_certificate_mac.cc index 2a604ee..a2a0eea 100644 --- a/net/base/x509_certificate_mac.cc +++ b/net/base/x509_certificate_mac.cc @@ -8,7 +8,6 @@ #include <Security/Security.h> #include <time.h> -#include "base/lazy_instance.h" #include "base/logging.h" #include "base/pickle.h" #include "base/mac/scoped_cftyperef.h" @@ -22,8 +21,6 @@ using base::Time; namespace net { -namespace { - class MacTrustedCertificates { public: // Sets the trusted root certificate used by tests. Call with |cert| set @@ -60,7 +57,7 @@ class MacTrustedCertificates { return merged_array; } private: - friend struct base::DefaultLazyInstanceTraits<MacTrustedCertificates>; + friend struct DefaultSingletonTraits<MacTrustedCertificates>; // Obtain an instance of MacTrustedCertificates via the singleton // interface. @@ -76,9 +73,11 @@ class MacTrustedCertificates { DISALLOW_COPY_AND_ASSIGN(MacTrustedCertificates); }; -base::LazyInstance<MacTrustedCertificates, - base::LeakyLazyInstanceTraits<MacTrustedCertificates> > - g_mac_trusted_certificates(base::LINKER_INITIALIZED); +void SetMacTestCertificate(X509Certificate* cert) { + Singleton<MacTrustedCertificates>::get()->SetTestCertificate(cert); +} + +namespace { typedef OSStatus (*SecTrustCopyExtendedResultFuncPtr)(SecTrustRef, CFDictionaryRef*); @@ -444,10 +443,6 @@ void AddCertificatesFromBytes(const char* data, size_t length, } // namespace -void SetMacTestCertificate(X509Certificate* cert) { - g_mac_trusted_certificates.Get().SetTestCertificate(cert); -} - void X509Certificate::Initialize() { const CSSM_X509_NAME* name; OSStatus status = SecCertificateGetSubject(cert_handle_, &name); @@ -550,7 +545,7 @@ int X509Certificate::Verify(const std::string& hostname, int flags, // Set the trusted anchor certificates for the SecTrustRef by merging the // system trust anchors and the test root certificate. CFArrayRef anchor_array = - g_mac_trusted_certificates.Get().CopyTrustedCertificateArray(); + Singleton<MacTrustedCertificates>::get()->CopyTrustedCertificateArray(); ScopedCFTypeRef<CFArrayRef> scoped_anchor_array(anchor_array); if (anchor_array) { status = SecTrustSetAnchorCertificates(trust_ref, anchor_array); |