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

Side by Side Diff: base/lazy_instance.cc

Issue 1538743002: Switch to standard integer types in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DEPS roll too Created 4 years, 12 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.h ('k') | base/lazy_instance_unittest.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "base/lazy_instance.h" 5 #include "base/lazy_instance.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/atomicops.h" 8 #include "base/atomicops.h"
9 #include "base/basictypes.h"
10 #include "base/threading/platform_thread.h" 9 #include "base/threading/platform_thread.h"
11 10
12 namespace base { 11 namespace base {
13 namespace internal { 12 namespace internal {
14 13
15 // TODO(joth): This function could be shared with Singleton, in place of its 14 // TODO(joth): This function could be shared with Singleton, in place of its
16 // WaitForInstance() call. 15 // WaitForInstance() call.
17 bool NeedsLazyInstance(subtle::AtomicWord* state) { 16 bool NeedsLazyInstance(subtle::AtomicWord* state) {
18 // Try to create the instance, if we're the first, will go from 0 to 17 // Try to create the instance, if we're the first, will go from 0 to
19 // kLazyInstanceStateCreating, otherwise we've already been beaten here. 18 // kLazyInstanceStateCreating, otherwise we've already been beaten here.
(...skipping 26 matching lines...) Expand all
46 // are in NeedsInstance() and Pointer(). 45 // are in NeedsInstance() and Pointer().
47 subtle::Release_Store(state, new_instance); 46 subtle::Release_Store(state, new_instance);
48 47
49 // Make sure that the lazily instantiated object will get destroyed at exit. 48 // Make sure that the lazily instantiated object will get destroyed at exit.
50 if (dtor) 49 if (dtor)
51 AtExitManager::RegisterCallback(dtor, lazy_instance); 50 AtExitManager::RegisterCallback(dtor, lazy_instance);
52 } 51 }
53 52
54 } // namespace internal 53 } // namespace internal
55 } // namespace base 54 } // namespace base
OLDNEW
« no previous file with comments | « base/lazy_instance.h ('k') | base/lazy_instance_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698