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

Unified Diff: base/memory/singleton.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 | « base/lazy_instance.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/singleton.h
diff --git a/base/memory/singleton.h b/base/memory/singleton.h
index bc4684b0b8940acf87ca016341465764967a26ab..f82a37ec865da1a966cb3b3681d2d1edf4ba1427 100644
--- a/base/memory/singleton.h
+++ b/base/memory/singleton.h
@@ -213,8 +213,11 @@ class Singleton {
// Return a pointer to the one true instance of the class.
static Type* get() {
+#ifndef NDEBUG
+ // Avoid making TLS lookup on release builds.
if (!Traits::kAllowedToAccessOnNonjoinableThread)
base::ThreadRestrictions::AssertSingletonAllowed();
+#endif
// Our AtomicWord doubles as a spinlock, where a value of
// kBeingCreatedMarker means the spinlock is being held for creation.
« no previous file with comments | « base/lazy_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698