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

Side by Side Diff: base/lazy_instance_unittest.cc

Issue 9192024: Add a convenience typedef LazyInstance<T>::Leaky to avoid repeating T. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « base/lazy_instance.h ('k') | base/nix/mime_util_xdg.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/threading/simple_thread.h" 8 #include "base/threading/simple_thread.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 static base::LazyInstance<DeleteLogger> test = LAZY_INSTANCE_INITIALIZER; 126 static base::LazyInstance<DeleteLogger> test = LAZY_INSTANCE_INITIALIZER;
127 test.Get().SetDeletedPtr(&deleted1); 127 test.Get().SetDeletedPtr(&deleted1);
128 } 128 }
129 EXPECT_TRUE(deleted1); 129 EXPECT_TRUE(deleted1);
130 130
131 // Check that using a *leaky* LazyInstance makes the dtor not run 131 // Check that using a *leaky* LazyInstance makes the dtor not run
132 // when the AtExitManager finishes. 132 // when the AtExitManager finishes.
133 bool deleted2 = false; 133 bool deleted2 = false;
134 { 134 {
135 base::ShadowingAtExitManager shadow; 135 base::ShadowingAtExitManager shadow;
136 static base::LazyInstance<DeleteLogger, 136 static base::LazyInstance<DeleteLogger>::Leaky
137 base::LeakyLazyInstanceTraits<DeleteLogger> >
138 test = LAZY_INSTANCE_INITIALIZER; 137 test = LAZY_INSTANCE_INITIALIZER;
139 test.Get().SetDeletedPtr(&deleted2); 138 test.Get().SetDeletedPtr(&deleted2);
140 } 139 }
141 EXPECT_FALSE(deleted2); 140 EXPECT_FALSE(deleted2);
142 } 141 }
OLDNEW
« no previous file with comments | « base/lazy_instance.h ('k') | base/nix/mime_util_xdg.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698