summaryrefslogtreecommitdiffstats
path: root/base/lazy_instance.h
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-06 01:11:54 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-06 01:11:54 +0000
commit5a8a8063c387f18f9f090d31cf385d65b048254b (patch)
tree77c00436b58f770922074f9dfe3e637dd7c0ab3c /base/lazy_instance.h
parent7001d5cc79cbe7f1faacacd5748431f3d7a859c6 (diff)
downloadchromium_src-5a8a8063c387f18f9f090d31cf385d65b048254b.zip
chromium_src-5a8a8063c387f18f9f090d31cf385d65b048254b.tar.gz
chromium_src-5a8a8063c387f18f9f090d31cf385d65b048254b.tar.bz2
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 R=fischman@chromium.org Review URL: https://codereview.chromium.org/187903007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255194 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/lazy_instance.h')
-rw-r--r--base/lazy_instance.h4
1 files changed, 4 insertions, 0 deletions
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;