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

Side by Side Diff: base/memory/singleton_unittest.cc

Issue 1549003002: Switch to standard integer types in base/memory/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/memory/singleton.h ('k') | base/memory/weak_ptr.h » ('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 <stdint.h>
6
5 #include "base/at_exit.h" 7 #include "base/at_exit.h"
6 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
7 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
8 10
9 namespace base { 11 namespace base {
10 namespace { 12 namespace {
11 13
12 static_assert(DefaultSingletonTraits<int>::kRegisterAtExit == true, 14 static_assert(DefaultSingletonTraits<int>::kRegisterAtExit == true,
13 "object must be deleted on process exit"); 15 "object must be deleted on process exit");
14 16
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 267
266 #define EXPECT_ALIGNED(ptr, align) \ 268 #define EXPECT_ALIGNED(ptr, align) \
267 EXPECT_EQ(0u, reinterpret_cast<uintptr_t>(ptr) & (align - 1)) 269 EXPECT_EQ(0u, reinterpret_cast<uintptr_t>(ptr) & (align - 1))
268 270
269 TEST_F(SingletonTest, Alignment) { 271 TEST_F(SingletonTest, Alignment) {
270 using base::AlignedMemory; 272 using base::AlignedMemory;
271 273
272 // Create some static singletons with increasing sizes and alignment 274 // Create some static singletons with increasing sizes and alignment
273 // requirements. By ordering this way, the linker will need to do some work to 275 // requirements. By ordering this way, the linker will need to do some work to
274 // ensure proper alignment of the static data. 276 // ensure proper alignment of the static data.
275 AlignedTestSingleton<int32>* align4 = 277 AlignedTestSingleton<int32_t>* align4 =
276 AlignedTestSingleton<int32>::GetInstance(); 278 AlignedTestSingleton<int32_t>::GetInstance();
277 AlignedTestSingleton<AlignedMemory<32, 32> >* align32 = 279 AlignedTestSingleton<AlignedMemory<32, 32> >* align32 =
278 AlignedTestSingleton<AlignedMemory<32, 32> >::GetInstance(); 280 AlignedTestSingleton<AlignedMemory<32, 32> >::GetInstance();
279 AlignedTestSingleton<AlignedMemory<128, 128> >* align128 = 281 AlignedTestSingleton<AlignedMemory<128, 128> >* align128 =
280 AlignedTestSingleton<AlignedMemory<128, 128> >::GetInstance(); 282 AlignedTestSingleton<AlignedMemory<128, 128> >::GetInstance();
281 AlignedTestSingleton<AlignedMemory<4096, 4096> >* align4096 = 283 AlignedTestSingleton<AlignedMemory<4096, 4096> >* align4096 =
282 AlignedTestSingleton<AlignedMemory<4096, 4096> >::GetInstance(); 284 AlignedTestSingleton<AlignedMemory<4096, 4096> >::GetInstance();
283 285
284 EXPECT_ALIGNED(align4, 4); 286 EXPECT_ALIGNED(align4, 4);
285 EXPECT_ALIGNED(align32, 32); 287 EXPECT_ALIGNED(align32, 32);
286 EXPECT_ALIGNED(align128, 128); 288 EXPECT_ALIGNED(align128, 128);
287 EXPECT_ALIGNED(align4096, 4096); 289 EXPECT_ALIGNED(align4096, 4096);
288 } 290 }
289 291
290 } // namespace 292 } // namespace
291 } // namespace base 293 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/singleton.h ('k') | base/memory/weak_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698