diff options
Diffstat (limited to 'base/lazy_instance_unittest.cc')
-rw-r--r-- | base/lazy_instance_unittest.cc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/base/lazy_instance_unittest.cc b/base/lazy_instance_unittest.cc index 8947b1291f..0aa4659465 100644 --- a/base/lazy_instance_unittest.cc +++ b/base/lazy_instance_unittest.cc @@ -45,7 +45,8 @@ int SlowConstructor::constructed = 0; class SlowDelegate : public base::DelegateSimpleThread::Delegate { public: - explicit SlowDelegate(base::LazyInstance<SlowConstructor>* lazy) + explicit SlowDelegate( + base::LazyInstance<SlowConstructor>::DestructorAtExit* lazy) : lazy_(lazy) {} void Run() override { @@ -54,13 +55,13 @@ class SlowDelegate : public base::DelegateSimpleThread::Delegate { } private: - base::LazyInstance<SlowConstructor>* lazy_; + base::LazyInstance<SlowConstructor>::DestructorAtExit* lazy_; }; } // namespace -static base::LazyInstance<ConstructAndDestructLogger> lazy_logger = - LAZY_INSTANCE_INITIALIZER; +static base::LazyInstance<ConstructAndDestructLogger>::DestructorAtExit + lazy_logger = LAZY_INSTANCE_INITIALIZER; TEST(LazyInstanceTest, Basic) { { @@ -81,7 +82,7 @@ TEST(LazyInstanceTest, Basic) { EXPECT_EQ(4, destructed_seq_.GetNext()); } -static base::LazyInstance<SlowConstructor> lazy_slow = +static base::LazyInstance<SlowConstructor>::DestructorAtExit lazy_slow = LAZY_INSTANCE_INITIALIZER; TEST(LazyInstanceTest, ConstructorThreadSafety) { @@ -126,7 +127,8 @@ TEST(LazyInstanceTest, LeakyLazyInstance) { bool deleted1 = false; { base::ShadowingAtExitManager shadow; - static base::LazyInstance<DeleteLogger> test = LAZY_INSTANCE_INITIALIZER; + static base::LazyInstance<DeleteLogger>::DestructorAtExit test = + LAZY_INSTANCE_INITIALIZER; test.Get().SetDeletedPtr(&deleted1); } EXPECT_TRUE(deleted1); @@ -164,9 +166,12 @@ TEST(LazyInstanceTest, Alignment) { // Create some static instances 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. - static LazyInstance<AlignedData<4> > align4 = LAZY_INSTANCE_INITIALIZER; - static LazyInstance<AlignedData<32> > align32 = LAZY_INSTANCE_INITIALIZER; - static LazyInstance<AlignedData<4096> > align4096 = LAZY_INSTANCE_INITIALIZER; + static LazyInstance<AlignedData<4>>::DestructorAtExit align4 = + LAZY_INSTANCE_INITIALIZER; + static LazyInstance<AlignedData<32>>::DestructorAtExit align32 = + LAZY_INSTANCE_INITIALIZER; + static LazyInstance<AlignedData<4096>>::DestructorAtExit align4096 = + LAZY_INSTANCE_INITIALIZER; EXPECT_ALIGNED(align4.Pointer(), 4); EXPECT_ALIGNED(align32.Pointer(), 32); |