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

Side by Side Diff: base/singleton.h

Issue 1992005: Update dynamic annotations and move them to base/third_party (Closed)
Patch Set: rebased Created 10 years, 7 months 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 unified diff | Download patch
« no previous file with comments | « base/lazy_instance.cc ('k') | base/third_party/dynamic_annotations/LICENSE » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_SINGLETON_H_ 5 #ifndef BASE_SINGLETON_H_
6 #define BASE_SINGLETON_H_ 6 #define BASE_SINGLETON_H_
7 7
8 #include "base/at_exit.h" 8 #include "base/at_exit.h"
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/dynamic_annotations.h"
11 #include "base/platform_thread.h" 10 #include "base/platform_thread.h"
11 #include "base/third_party/dynamic_annotations/dynamic_annotations.h"
12 12
13 // Default traits for Singleton<Type>. Calls operator new and operator delete on 13 // Default traits for Singleton<Type>. Calls operator new and operator delete on
14 // the object. Registers automatic deletion at process exit. 14 // the object. Registers automatic deletion at process exit.
15 // Overload if you need arguments or another memory allocation function. 15 // Overload if you need arguments or another memory allocation function.
16 template<typename Type> 16 template<typename Type>
17 struct DefaultSingletonTraits { 17 struct DefaultSingletonTraits {
18 // Allocates the object. 18 // Allocates the object.
19 static Type* New() { 19 static Type* New() {
20 // The parenthesis is very important here; it forces POD type 20 // The parenthesis is very important here; it forces POD type
21 // initialization. 21 // initialization.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 base::subtle::NoBarrier_AtomicExchange(&instance_, 0))); 230 base::subtle::NoBarrier_AtomicExchange(&instance_, 0)));
231 } 231 }
232 static base::subtle::AtomicWord instance_; 232 static base::subtle::AtomicWord instance_;
233 }; 233 };
234 234
235 template <typename Type, typename Traits, typename DifferentiatingType> 235 template <typename Type, typename Traits, typename DifferentiatingType>
236 base::subtle::AtomicWord Singleton<Type, Traits, DifferentiatingType>:: 236 base::subtle::AtomicWord Singleton<Type, Traits, DifferentiatingType>::
237 instance_ = 0; 237 instance_ = 0;
238 238
239 #endif // BASE_SINGLETON_H_ 239 #endif // BASE_SINGLETON_H_
OLDNEW
« no previous file with comments | « base/lazy_instance.cc ('k') | base/third_party/dynamic_annotations/LICENSE » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698