From ee432ee0a565736be395b8729bc811212fd88bf3 Mon Sep 17 00:00:00 2001 From: "willchan@chromium.org" Date: Fri, 19 Nov 2010 19:17:08 +0000 Subject: Revert 66719 - Reland r65996. Disallows Singletons on non-joinable thread. Test breakages caused by this change have been fixed here or in other changelists. BUG=61753 TEST=none Review URL: http://codereview.chromium.org/5024003 TBR=willchan@chromium.org Review URL: http://codereview.chromium.org/5206005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66791 0039d316-1c4b-4281-b951-d872f2087c98 --- base/lazy_instance.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'base/lazy_instance.h') diff --git a/base/lazy_instance.h b/base/lazy_instance.h index f8d5987..ebf1e73 100644 --- a/base/lazy_instance.h +++ b/base/lazy_instance.h @@ -36,19 +36,14 @@ #define BASE_LAZY_INSTANCE_H_ #pragma once -#include // For placement new. - #include "base/atomicops.h" #include "base/basictypes.h" #include "base/third_party/dynamic_annotations/dynamic_annotations.h" -#include "base/thread_restrictions.h" namespace base { template struct DefaultLazyInstanceTraits { - static const bool kAllowedToAccessOnNonjoinableThread = false; - static Type* New(void* instance) { // Use placement new to initialize our instance in our preallocated space. // The parenthesis is very important here to force POD type initialization. @@ -62,8 +57,6 @@ struct DefaultLazyInstanceTraits { template struct LeakyLazyInstanceTraits { - static const bool kAllowedToAccessOnNonjoinableThread = true; - static Type* New(void* instance) { return DefaultLazyInstanceTraits::New(instance); } @@ -119,9 +112,6 @@ class LazyInstance : public LazyInstanceHelper { } Type* Pointer() { - if (!Traits::kAllowedToAccessOnNonjoinableThread) - base::ThreadRestrictions::AssertSingletonAllowed(); - // We will hopefully have fast access when the instance is already created. if ((base::subtle::NoBarrier_Load(&state_) != STATE_CREATED) && NeedsInstance()) { @@ -136,6 +126,7 @@ class LazyInstance : public LazyInstanceHelper { // and CompleteInstance(...) happens before "return instance_" below. // See the corresponding HAPPENS_BEFORE in CompleteInstance(...). ANNOTATE_HAPPENS_AFTER(&state_); + return instance_; } -- cgit v1.1