summaryrefslogtreecommitdiffstats
path: root/net/socket
diff options
context:
space:
mode:
Diffstat (limited to 'net/socket')
-rw-r--r--net/socket/client_socket_factory.cc7
-rw-r--r--net/socket/dns_cert_provenance_checker.cc11
-rw-r--r--net/socket/ssl_client_socket_mac.cc9
-rw-r--r--net/socket/ssl_client_socket_nss.cc7
-rw-r--r--net/socket/ssl_client_socket_win.cc16
5 files changed, 16 insertions, 34 deletions
diff --git a/net/socket/client_socket_factory.cc b/net/socket/client_socket_factory.cc
index 1c998c6..8965630 100644
--- a/net/socket/client_socket_factory.cc
+++ b/net/socket/client_socket_factory.cc
@@ -4,7 +4,7 @@
#include "net/socket/client_socket_factory.h"
-#include "base/lazy_instance.h"
+#include "base/singleton.h"
#include "build/build_config.h"
#include "net/socket/client_socket_handle.h"
#if defined(OS_WIN)
@@ -71,14 +71,11 @@ class DefaultClientSocketFactory : public ClientSocketFactory {
}
};
-static base::LazyInstance<DefaultClientSocketFactory>
- g_default_client_socket_factory(base::LINKER_INITIALIZED);
-
} // namespace
// static
ClientSocketFactory* ClientSocketFactory::GetDefaultFactory() {
- return g_default_client_socket_factory.Pointer();
+ return Singleton<DefaultClientSocketFactory>::get();
}
// static
diff --git a/net/socket/dns_cert_provenance_checker.cc b/net/socket/dns_cert_provenance_checker.cc
index 2243755..27c4982 100644
--- a/net/socket/dns_cert_provenance_checker.cc
+++ b/net/socket/dns_cert_provenance_checker.cc
@@ -19,10 +19,10 @@
#include "base/basictypes.h"
#include "base/crypto/encryptor.h"
#include "base/crypto/symmetric_key.h"
-#include "base/lazy_instance.h"
#include "base/non_thread_safe.h"
#include "base/pickle.h"
#include "base/scoped_ptr.h"
+#include "base/singleton.h"
#include "net/base/completion_callback.h"
#include "net/base/dns_util.h"
#include "net/base/dnsrr_resolver.h"
@@ -72,16 +72,13 @@ class DnsCertLimits {
}
private:
- friend struct base::DefaultLazyInstanceTraits<DnsCertLimits>;
+ friend struct DefaultSingletonTraits<DnsCertLimits>;
std::set<std::string> uploaded_hostnames_;
DISALLOW_COPY_AND_ASSIGN(DnsCertLimits);
};
-static base::LazyInstance<DnsCertLimits> g_dns_cert_limits(
- base::LINKER_INITIALIZED);
-
// DnsCertProvenanceCheck performs the DNS lookup of the certificate. This
// class is self-deleting.
class DnsCertProvenanceCheck : public NonThreadSafe {
@@ -108,7 +105,7 @@ class DnsCertProvenanceCheck : public NonThreadSafe {
if (der_certs_.empty())
return;
- DnsCertLimits* const limits = g_dns_cert_limits.Pointer();
+ DnsCertLimits* const limits = Singleton<DnsCertLimits>::get();
if (limits->HaveReachedMaxUploads() ||
limits->HaveUploadedForHostname(hostname_)) {
return;
@@ -149,7 +146,7 @@ class DnsCertProvenanceCheck : public NonThreadSafe {
LOG(ERROR) << "FAILED"
<< " hostname:" << hostname_
<< " domain:" << domain_;
- g_dns_cert_limits.Get().DidUpload(hostname_);
+ Singleton<DnsCertLimits>::get()->DidUpload(hostname_);
delegate_->OnDnsCertLookupFailed(hostname_, der_certs_);
} else if (status == OK) {
LOG(ERROR) << "GOOD"
diff --git a/net/socket/ssl_client_socket_mac.cc b/net/socket/ssl_client_socket_mac.cc
index 488beeb..fb0c26e 100644
--- a/net/socket/ssl_client_socket_mac.cc
+++ b/net/socket/ssl_client_socket_mac.cc
@@ -11,8 +11,8 @@
#include <algorithm>
-#include "base/lazy_instance.h"
#include "base/mac/scoped_cftyperef.h"
+#include "base/singleton.h"
#include "base/string_util.h"
#include "net/base/address_list.h"
#include "net/base/cert_verifier.h"
@@ -475,7 +475,7 @@ class EnabledCipherSuites {
const std::vector<SSLCipherSuite>& ciphers() const { return ciphers_; }
private:
- friend struct base::DefaultLazyInstanceTraits<EnabledCipherSuites>;
+ friend struct DefaultSingletonTraits<EnabledCipherSuites>;
EnabledCipherSuites();
~EnabledCipherSuites() {}
@@ -484,9 +484,6 @@ class EnabledCipherSuites {
DISALLOW_COPY_AND_ASSIGN(EnabledCipherSuites);
};
-static base::LazyInstance<EnabledCipherSuites> g_enabled_cipher_suites(
- base::LINKER_INITIALIZED);
-
EnabledCipherSuites::EnabledCipherSuites() {
SSLContextRef ssl_context;
OSStatus status = SSLNewContext(false, &ssl_context);
@@ -789,7 +786,7 @@ int SSLClientSocketMac::InitializeSSLContext() {
return NetErrorFromOSStatus(status);
std::vector<SSLCipherSuite> enabled_ciphers =
- g_enabled_cipher_suites.Get().ciphers();
+ Singleton<EnabledCipherSuites>::get()->ciphers();
CipherSuiteIsDisabledFunctor is_disabled_cipher(
ssl_config_.disabled_cipher_suites);
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index f946819..fff4352 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -63,9 +63,9 @@
#include "base/compiler_specific.h"
#include "base/metrics/histogram.h"
-#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/nss_util.h"
+#include "base/singleton.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
@@ -185,9 +185,6 @@ class NSSSSLInitSingleton {
}
};
-static base::LazyInstance<NSSSSLInitSingleton> g_nss_ssl_init_singleton(
- base::LINKER_INITIALIZED);
-
// Initialize the NSS SSL library if it isn't already initialized. This must
// be called before any other NSS SSL functions. This function is
// thread-safe, and the NSS SSL library will only ever be initialized once.
@@ -198,7 +195,7 @@ void EnsureNSSSSLInit() {
// http://code.google.com/p/chromium/issues/detail?id=59847
base::ThreadRestrictions::ScopedAllowIO allow_io;
- g_nss_ssl_init_singleton.Get();
+ Singleton<NSSSSLInitSingleton>::get();
}
// The default error mapping function.
diff --git a/net/socket/ssl_client_socket_win.cc b/net/socket/ssl_client_socket_win.cc
index 19c3814..fbe4913 100644
--- a/net/socket/ssl_client_socket_win.cc
+++ b/net/socket/ssl_client_socket_win.cc
@@ -8,8 +8,8 @@
#include <map>
#include "base/compiler_specific.h"
-#include "base/lazy_instance.h"
#include "base/lock.h"
+#include "base/singleton.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -194,9 +194,6 @@ class CredHandleTable {
CredHandleMap client_cert_creds_;
};
-static base::LazyInstance<CredHandleTable> g_cred_handle_table(
- base::LINKER_INITIALIZED);
-
// static
int CredHandleTable::InitializeHandle(CredHandle* handle,
PCCERT_CONTEXT client_cert,
@@ -288,9 +285,9 @@ static int GetCredHandle(PCCERT_CONTEXT client_cert,
NOTREACHED();
return ERR_UNEXPECTED;
}
- return g_cred_handle_table.Get().GetHandle(client_cert,
- ssl_version_mask,
- handle_ptr);
+ return Singleton<CredHandleTable>::get()->GetHandle(client_cert,
+ ssl_version_mask,
+ handle_ptr);
}
//-----------------------------------------------------------------------------
@@ -359,9 +356,6 @@ class ClientCertStore {
HCERTSTORE store_;
};
-static base::LazyInstance<ClientCertStore> g_client_cert_store(
- base::LINKER_INITIALIZED);
-
//-----------------------------------------------------------------------------
// Size of recv_buffer_
@@ -513,7 +507,7 @@ void SSLClientSocketWin::GetSSLCertRequestInfo(
// Copy it to our own certificate store, so that we can close the "MY"
// certificate store before returning from this function.
PCCERT_CONTEXT cert_context2 =
- g_client_cert_store.Get().CopyCertContext(cert_context);
+ Singleton<ClientCertStore>::get()->CopyCertContext(cert_context);
if (!cert_context2) {
NOTREACHED();
continue;