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/threading/non_thread_safe.h" | 5 #include "base/threading/non_thread_safe.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/threading/simple_thread.h" | 11 #include "base/threading/simple_thread.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 // Duplicated from base/threading/non_thread_safe.h so that we can be | 14 // Duplicated from base/threading/non_thread_safe.h so that we can be |
15 // good citizens there and undef the macro. | 15 // good citizens there and undef the macro. |
16 #if (!defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)) | 16 #if DCHECK_IS_ON() |
17 #define ENABLE_NON_THREAD_SAFE 1 | 17 #define ENABLE_NON_THREAD_SAFE 1 |
danakj
2016/07/19 20:17:01
and here..
gab
2016/07/20 02:43:58
Done.
| |
18 #else | 18 #else |
19 #define ENABLE_NON_THREAD_SAFE 0 | 19 #define ENABLE_NON_THREAD_SAFE 0 |
20 #endif | 20 #endif |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Simple class to exersice the basics of NonThreadSafe. | 26 // Simple class to exersice the basics of NonThreadSafe. |
27 // Both the destructor and DoStuff should verify that they were | 27 // Both the destructor and DoStuff should verify that they were |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 NonThreadSafeClass::DestructorOnDifferentThreadImpl(); | 156 NonThreadSafeClass::DestructorOnDifferentThreadImpl(); |
157 } | 157 } |
158 #endif // ENABLE_NON_THREAD_SAFE | 158 #endif // ENABLE_NON_THREAD_SAFE |
159 | 159 |
160 #endif // GTEST_HAS_DEATH_TEST || !ENABLE_NON_THREAD_SAFE | 160 #endif // GTEST_HAS_DEATH_TEST || !ENABLE_NON_THREAD_SAFE |
161 | 161 |
162 // Just in case we ever get lumped together with other compilation units. | 162 // Just in case we ever get lumped together with other compilation units. |
163 #undef ENABLE_NON_THREAD_SAFE | 163 #undef ENABLE_NON_THREAD_SAFE |
164 | 164 |
165 } // namespace base | 165 } // namespace base |
OLD | NEW |