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

Unified Diff: base/memory/singleton_unittest.cc

Issue 2932053002: Use C++11 alignment primitives (Closed)
Patch Set: Put back ALIGNAS Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: base/memory/singleton_unittest.cc
diff --git a/base/memory/singleton_unittest.cc b/base/memory/singleton_unittest.cc
index a15145c8747145cb3f6e6774890307cc0fa46794..cfd66b87097bcc1afc5b0c24260e10ef46ec49d2 100644
--- a/base/memory/singleton_unittest.cc
+++ b/base/memory/singleton_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <stdint.h>
+#include <type_traits>
#include "base/at_exit.h"
#include "base/memory/singleton.h"
@@ -269,19 +270,18 @@ TEST_F(SingletonTest, Basic) {
EXPECT_EQ(0u, reinterpret_cast<uintptr_t>(ptr) & (align - 1))
TEST_F(SingletonTest, Alignment) {
- using base::AlignedMemory;
-
// Create some static singletons with increasing sizes and alignment
// requirements. By ordering this way, the linker will need to do some work to
// ensure proper alignment of the static data.
AlignedTestSingleton<int32_t>* align4 =
AlignedTestSingleton<int32_t>::GetInstance();
- AlignedTestSingleton<AlignedMemory<32, 32> >* align32 =
- AlignedTestSingleton<AlignedMemory<32, 32> >::GetInstance();
- AlignedTestSingleton<AlignedMemory<128, 128> >* align128 =
- AlignedTestSingleton<AlignedMemory<128, 128> >::GetInstance();
- AlignedTestSingleton<AlignedMemory<4096, 4096> >* align4096 =
- AlignedTestSingleton<AlignedMemory<4096, 4096> >::GetInstance();
+ AlignedTestSingleton<std::aligned_storage<32, 32>::type>* align32 =
+ AlignedTestSingleton<std::aligned_storage<32, 32>::type>::GetInstance();
+ AlignedTestSingleton<std::aligned_storage<128, 128>::type>* align128 =
+ AlignedTestSingleton<std::aligned_storage<128, 128>::type>::GetInstance();
+ AlignedTestSingleton<std::aligned_storage<4096, 4096>::type>* align4096 =
+ AlignedTestSingleton<
+ std::aligned_storage<4096, 4096>::type>::GetInstance();
EXPECT_ALIGNED(align4, 4);
EXPECT_ALIGNED(align32, 32);

Powered by Google App Engine
This is Rietveld 408576698