summaryrefslogtreecommitdiffstats
path: root/base/lazy_instance.h
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-13 23:44:20 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-13 23:44:20 +0000
commit2902738f2a36d4f0ef22e25369e653f4eda2a7aa (patch)
tree582ce3d66406a222edb686625227c1eea475d285 /base/lazy_instance.h
parent2d39894da98b2ae12b4052776c4fcf23d1bf2442 (diff)
downloadchromium_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/lazy_instance.h')
-rw-r--r--base/lazy_instance.h9
1 files changed, 0 insertions, 9 deletions
diff --git a/base/lazy_instance.h b/base/lazy_instance.h
index 27cb784..ebf1e73 100644
--- a/base/lazy_instance.h
+++ b/base/lazy_instance.h
@@ -36,18 +36,14 @@
#define BASE_LAZY_INSTANCE_H_
#pragma once
-#include <new> // 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 <typename Type>
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.
@@ -61,8 +57,6 @@ struct DefaultLazyInstanceTraits {
template <typename Type>
struct LeakyLazyInstanceTraits {
- static const bool kAllowedToAccessOnNonjoinableThread = true;
-
static Type* New(void* instance) {
return DefaultLazyInstanceTraits<Type>::New(instance);
}
@@ -118,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()) {