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

Unified Diff: base/lazy_instance.h

Issue 5206005: Revert 66719 - Reland r65996. Disallows Singletons on non-joinable thread.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 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/message_loop_proxy_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/lazy_instance.h
===================================================================
--- base/lazy_instance.h (revision 66790)
+++ base/lazy_instance.h (working copy)
@@ -36,19 +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.
@@ -62,8 +57,6 @@
template <typename Type>
struct LeakyLazyInstanceTraits {
- static const bool kAllowedToAccessOnNonjoinableThread = true;
-
static Type* New(void* instance) {
return DefaultLazyInstanceTraits<Type>::New(instance);
}
@@ -119,9 +112,6 @@
}
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 @@
// and CompleteInstance(...) happens before "return instance_" below.
// See the corresponding HAPPENS_BEFORE in CompleteInstance(...).
ANNOTATE_HAPPENS_AFTER(&state_);
+
return instance_;
}
« no previous file with comments | « no previous file | base/message_loop_proxy_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698