Allow linker initialization of lazy instance
Using the initializer list construct = {0} allows the object to be linker initialized.
Modify the LazyInstance class design to make it a pod aggregate type that can be linker initialized this way. Also combines the instance and state members, in line with the Singleton<> class design.
Introduces a new LAZY_INSTANCE_INITIALIZER macro specifically for using to init all lazy instances + modify all existing callsites to use it. (Old code would no longer compile)
BUG=94925
TEST=existing tests pass. http://build.chromium.org/f/chromium/perf/linux-release/sizes/report.html?history=150&header=chrome-si&graph=chrome-si&rev=-1 should step downward.
[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
Review URL: http://codereview.chromium.org/8491043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110076 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc
index 803b01c..6bebd0d6 100644
--- a/crypto/nss_util.cc
+++ b/crypto/nss_util.cc
@@ -219,7 +219,7 @@
base::LazyInstance<NSPRInitSingleton,
base::LeakyLazyInstanceTraits<NSPRInitSingleton> >
- g_nspr_singleton(base::LINKER_INITIALIZED);
+ g_nspr_singleton = LAZY_INSTANCE_INITIALIZER;
class NSSInitSingleton {
public:
@@ -614,7 +614,7 @@
base::LazyInstance<NSSInitSingleton,
base::LeakyLazyInstanceTraits<NSSInitSingleton> >
- g_nss_singleton(base::LINKER_INITIALIZED);
+ g_nss_singleton = LAZY_INSTANCE_INITIALIZER;
} // namespace