diff options
-rw-r--r-- | base/android/build_info.cc | 2 | ||||
-rw-r--r-- | base/lazy_instance.h | 4 | ||||
-rw-r--r-- | base/memory/singleton.h | 4 |
3 files changed, 10 insertions, 0 deletions
diff --git a/base/android/build_info.cc b/base/android/build_info.cc index 9f7361d..a1755af 100644 --- a/base/android/build_info.cc +++ b/base/android/build_info.cc @@ -37,7 +37,9 @@ struct BuildInfoSingletonTraits { } static const bool kRegisterAtExit = false; +#ifndef NDEBUG static const bool kAllowedToAccessOnNonjoinableThread = true; +#endif }; BuildInfo::BuildInfo(JNIEnv* env) diff --git a/base/lazy_instance.h b/base/lazy_instance.h index 3935780..05a7c5d 100644 --- a/base/lazy_instance.h +++ b/base/lazy_instance.h @@ -57,7 +57,9 @@ namespace base { 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 @@ namespace internal { 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; diff --git a/base/memory/singleton.h b/base/memory/singleton.h index 0d4fc89..355aad0 100644 --- a/base/memory/singleton.h +++ b/base/memory/singleton.h @@ -63,10 +63,12 @@ struct DefaultSingletonTraits { // exit. See below for the required call that makes this happen. static const bool kRegisterAtExit = true; +#ifndef NDEBUG // Set to false to disallow access on a non-joinable thread. This is // different from kRegisterAtExit because StaticMemorySingletonTraits allows // access on non-joinable threads, and gracefully handles this. static const bool kAllowedToAccessOnNonjoinableThread = false; +#endif }; @@ -76,7 +78,9 @@ struct DefaultSingletonTraits { template<typename Type> struct LeakySingletonTraits : public DefaultSingletonTraits<Type> { static const bool kRegisterAtExit = false; +#ifndef NDEBUG static const bool kAllowedToAccessOnNonjoinableThread = true; +#endif }; |