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

Side by Side Diff: base/lazy_instance_unittest.cc

Issue 9415039: Add base::StaticAtomicSequenceNumber. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update Created 8 years, 9 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/atomic_sequence_num.h ('k') | base/message_loop_proxy_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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/atomic_sequence_num.h" 6 #include "base/atomic_sequence_num.h"
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/memory/aligned_memory.h" 8 #include "base/memory/aligned_memory.h"
9 #include "base/threading/simple_thread.h" 9 #include "base/threading/simple_thread.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace { 12 namespace {
13 13
14 base::AtomicSequenceNumber constructed_seq_(base::LINKER_INITIALIZED); 14 base::StaticAtomicSequenceNumber constructed_seq_;
15 base::AtomicSequenceNumber destructed_seq_(base::LINKER_INITIALIZED); 15 base::StaticAtomicSequenceNumber destructed_seq_;
16 16
17 class ConstructAndDestructLogger { 17 class ConstructAndDestructLogger {
18 public: 18 public:
19 ConstructAndDestructLogger() { 19 ConstructAndDestructLogger() {
20 constructed_seq_.GetNext(); 20 constructed_seq_.GetNext();
21 } 21 }
22 ~ConstructAndDestructLogger() { 22 ~ConstructAndDestructLogger() {
23 destructed_seq_.GetNext(); 23 destructed_seq_.GetNext();
24 } 24 }
25 }; 25 };
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // requirements. By ordering this way, the linker will need to do some work to 163 // requirements. By ordering this way, the linker will need to do some work to
164 // ensure proper alignment of the static data. 164 // ensure proper alignment of the static data.
165 static LazyInstance<AlignedData<4> > align4 = LAZY_INSTANCE_INITIALIZER; 165 static LazyInstance<AlignedData<4> > align4 = LAZY_INSTANCE_INITIALIZER;
166 static LazyInstance<AlignedData<32> > align32 = LAZY_INSTANCE_INITIALIZER; 166 static LazyInstance<AlignedData<32> > align32 = LAZY_INSTANCE_INITIALIZER;
167 static LazyInstance<AlignedData<4096> > align4096 = LAZY_INSTANCE_INITIALIZER; 167 static LazyInstance<AlignedData<4096> > align4096 = LAZY_INSTANCE_INITIALIZER;
168 168
169 EXPECT_ALIGNED(align4.Pointer(), 4); 169 EXPECT_ALIGNED(align4.Pointer(), 4);
170 EXPECT_ALIGNED(align32.Pointer(), 32); 170 EXPECT_ALIGNED(align32.Pointer(), 32);
171 EXPECT_ALIGNED(align4096.Pointer(), 4096); 171 EXPECT_ALIGNED(align4096.Pointer(), 4096);
172 } 172 }
OLDNEW
« no previous file with comments | « base/atomic_sequence_num.h ('k') | base/message_loop_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698