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/thread_checker.h" | 5 #include "base/threading/thread_checker.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/thread_checker.h so that we can be | 14 // Duplicated from base/threading/thread_checker.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_THREAD_CHECKER 1 | 17 #define ENABLE_THREAD_CHECKER 1 |
danakj
2016/07/19 20:17:01
and here.. and in the thread_checker.h? https://cs
gab
2016/07/20 02:43:58
Done.
| |
18 #else | 18 #else |
19 #define ENABLE_THREAD_CHECKER 0 | 19 #define ENABLE_THREAD_CHECKER 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 exercise the basics of ThreadChecker. | 26 // Simple class to exercise the basics of ThreadChecker. |
27 // Both the destructor and DoStuff should verify that they were | 27 // Both the destructor and DoStuff should verify that they were |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl(); | 172 ThreadCheckerClass::DetachThenCallFromDifferentThreadImpl(); |
173 } | 173 } |
174 #endif // ENABLE_THREAD_CHECKER | 174 #endif // ENABLE_THREAD_CHECKER |
175 | 175 |
176 #endif // GTEST_HAS_DEATH_TEST || !ENABLE_THREAD_CHECKER | 176 #endif // GTEST_HAS_DEATH_TEST || !ENABLE_THREAD_CHECKER |
177 | 177 |
178 // Just in case we ever get lumped together with other compilation units. | 178 // Just in case we ever get lumped together with other compilation units. |
179 #undef ENABLE_THREAD_CHECKER | 179 #undef ENABLE_THREAD_CHECKER |
180 | 180 |
181 } // namespace base | 181 } // namespace base |
OLD | NEW |