Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Unified Diff: base/lazy_instance.h

Issue 8465010: Minor perf and size optimization - don't do asserts in release build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/memory/singleton.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/lazy_instance.h
diff --git a/base/lazy_instance.h b/base/lazy_instance.h
index 496fc1f0404948986de277bfe7b472827dce9cc6..ac94a009111cf230ef70984add4b22034f53fdac 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,
« no previous file with comments | « no previous file | base/memory/singleton.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698