OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |