diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-13 23:44:20 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-13 23:44:20 +0000 |
commit | 2902738f2a36d4f0ef22e25369e653f4eda2a7aa (patch) | |
tree | 582ce3d66406a222edb686625227c1eea475d285 /base/singleton.h | |
parent | 2d39894da98b2ae12b4052776c4fcf23d1bf2442 (diff) | |
download | chromium_src-2902738f2a36d4f0ef22e25369e653f4eda2a7aa.zip chromium_src-2902738f2a36d4f0ef22e25369e653f4eda2a7aa.tar.gz chromium_src-2902738f2a36d4f0ef22e25369e653f4eda2a7aa.tar.bz2 |
Revert 65996 (test breakage) - Disallow Singleton and LazyInstance on non-joinable threads.
Fix all known instances or explicitly allow them. Usually the fix involves switching from Default traits to Lazy traits.
BUG=61753
TEST=none
Review URL: http://codereview.chromium.org/4635012
TBR=willchan@chromium.org
Review URL: http://codereview.chromium.org/4980001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66071 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/singleton.h')
-rw-r--r-- | base/singleton.h | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/base/singleton.h b/base/singleton.h index 7caa8ee..564b686 100644 --- a/base/singleton.h +++ b/base/singleton.h @@ -9,7 +9,6 @@ #include "base/at_exit.h" #include "base/atomicops.h" #include "base/third_party/dynamic_annotations/dynamic_annotations.h" -#include "base/thread_restrictions.h" // Default traits for Singleton<Type>. Calls operator new and operator delete on // the object. Registers automatic deletion at process exit. @@ -31,11 +30,6 @@ struct DefaultSingletonTraits { // Set to true to automatically register deletion of the object on process // exit. See below for the required call that makes this happen. static const bool kRegisterAtExit = true; - - // 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; }; @@ -45,7 +39,6 @@ struct DefaultSingletonTraits { template<typename Type> struct LeakySingletonTraits : public DefaultSingletonTraits<Type> { static const bool kRegisterAtExit = false; - static const bool kAllowedToAccessOnNonjoinableThread = true; }; @@ -92,7 +85,6 @@ struct StaticMemorySingletonTraits { } static const bool kRegisterAtExit = true; - static const bool kAllowedToAccessOnNonjoinableThread = true; // Exposed for unittesting. static void Resurrect() { @@ -184,9 +176,6 @@ class Singleton { // Return a pointer to the one true instance of the class. static Type* get() { - if (!Traits::kAllowedToAccessOnNonjoinableThread) - base::ThreadRestrictions::AssertSingletonAllowed(); - // Our AtomicWord doubles as a spinlock, where a value of // kBeingCreatedMarker means the spinlock is being held for creation. static const base::subtle::AtomicWord kBeingCreatedMarker = 1; |