Make kAllowedToAccessOnNonjoinableThread debug-only.
This is only used in !NDEBUG builds, and making the variable only available
there makes it harder to break -Wunused-const-variable builds with custom
traits. Follow-up to r255159.
BUG=349521,307668
[email protected]
Review URL: https://codereview.chromium.org/187903007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255194 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/lazy_instance.h b/base/lazy_instance.h
index 3935780..05a7c5d8 100644
--- a/base/lazy_instance.h
+++ b/base/lazy_instance.h
@@ -57,7 +57,9 @@
template <typename Type>
struct DefaultLazyInstanceTraits {
static const bool kRegisterOnExit = true;
+#ifndef NDEBUG
static const bool kAllowedToAccessOnNonjoinableThread = false;
+#endif
static Type* New(void* instance) {
DCHECK_EQ(reinterpret_cast<uintptr_t>(instance) & (ALIGNOF(Type) - 1), 0u)
@@ -89,7 +91,9 @@
template <typename Type>
struct LeakyLazyInstanceTraits {
static const bool kRegisterOnExit = false;
+#ifndef NDEBUG
static const bool kAllowedToAccessOnNonjoinableThread = true;
+#endif
static Type* New(void* instance) {
ANNOTATE_SCOPED_MEMORY_LEAK;