Index: net/base/x509_certificate_mac.cc |
=================================================================== |
--- net/base/x509_certificate_mac.cc (revision 66790) |
+++ net/base/x509_certificate_mac.cc (working copy) |
@@ -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 @@ |
namespace net { |
-namespace { |
- |
class MacTrustedCertificates { |
public: |
// Sets the trusted root certificate used by tests. Call with |cert| set |
@@ -60,7 +57,7 @@ |
return merged_array; |
} |
private: |
- friend struct base::DefaultLazyInstanceTraits<MacTrustedCertificates>; |
+ friend struct DefaultSingletonTraits<MacTrustedCertificates>; |
// Obtain an instance of MacTrustedCertificates via the singleton |
// interface. |
@@ -76,10 +73,12 @@ |
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 @@ |
} // 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 @@ |
// 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); |