diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-04 17:29:10 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-04 17:29:10 +0000 |
commit | 3c7a7f33e5ba0f1424f5e594bed9aea1857f5909 (patch) | |
tree | 3b455cd8dd640905d6a9c70e7c79f4c5cfa5c625 /base/lazy_instance.h | |
parent | c8d245577a6395dacdff2b3d76fb0371b002d4e9 (diff) | |
download | chromium_src-3c7a7f33e5ba0f1424f5e594bed9aea1857f5909.zip chromium_src-3c7a7f33e5ba0f1424f5e594bed9aea1857f5909.tar.gz chromium_src-3c7a7f33e5ba0f1424f5e594bed9aea1857f5909.tar.bz2 |
Minor perf and size optimization - don't do asserts in release build
Avoiding the pthread_getspecific call on every pointer access seems worth it (and it reduces templated code size)
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/8465010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108678 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/lazy_instance.h')
-rw-r--r-- | base/lazy_instance.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/base/lazy_instance.h b/base/lazy_instance.h index 496fc1f..ac94a00 100644 --- a/base/lazy_instance.h +++ b/base/lazy_instance.h @@ -133,8 +133,11 @@ class LazyInstance : public LazyInstanceHelper { } Type* Pointer() { +#ifndef NDEBUG + // Avoid making TLS lookup on release builds. if (!Traits::kAllowedToAccessOnNonjoinableThread) base::ThreadRestrictions::AssertSingletonAllowed(); +#endif // We will hopefully have fast access when the instance is already created. // Since a thread sees state_ != STATE_CREATED at most once, |