OLD | NEW |
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 #ifndef BASE_THREADING_THREAD_COLLISION_WARNER_H_ | 5 #ifndef BASE_THREADING_THREAD_COLLISION_WARNER_H_ |
6 #define BASE_THREADING_THREAD_COLLISION_WARNER_H_ | 6 #define BASE_THREADING_THREAD_COLLISION_WARNER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // Asserts the call is never called simultaneously in two threads. Used at | 112 // Asserts the call is never called simultaneously in two threads. Used at |
113 // member function scope. Same as DFAKE_SCOPED_LOCK but allows recursive locks. | 113 // member function scope. Same as DFAKE_SCOPED_LOCK but allows recursive locks. |
114 #define DFAKE_SCOPED_RECURSIVE_LOCK(obj) \ | 114 #define DFAKE_SCOPED_RECURSIVE_LOCK(obj) \ |
115 base::ThreadCollisionWarner::ScopedRecursiveCheck sr_check_##obj(&obj) | 115 base::ThreadCollisionWarner::ScopedRecursiveCheck sr_check_##obj(&obj) |
116 // Asserts the code is always executed in the same thread. | 116 // Asserts the code is always executed in the same thread. |
117 #define DFAKE_SCOPED_LOCK_THREAD_LOCKED(obj) \ | 117 #define DFAKE_SCOPED_LOCK_THREAD_LOCKED(obj) \ |
118 base::ThreadCollisionWarner::Check check_##obj(&obj) | 118 base::ThreadCollisionWarner::Check check_##obj(&obj) |
119 | 119 |
120 #else | 120 #else |
121 | 121 |
122 #define DFAKE_MUTEX(obj) | 122 #define DFAKE_MUTEX(obj) typedef void InternalFakeMutexType##obj |
123 #define DFAKE_SCOPED_LOCK(obj) ((void)0) | 123 #define DFAKE_SCOPED_LOCK(obj) ((void)0) |
124 #define DFAKE_SCOPED_RECURSIVE_LOCK(obj) ((void)0) | 124 #define DFAKE_SCOPED_RECURSIVE_LOCK(obj) ((void)0) |
125 #define DFAKE_SCOPED_LOCK_THREAD_LOCKED(obj) ((void)0) | 125 #define DFAKE_SCOPED_LOCK_THREAD_LOCKED(obj) ((void)0) |
126 | 126 |
127 #endif | 127 #endif |
128 | 128 |
129 namespace base { | 129 namespace base { |
130 | 130 |
131 // The class ThreadCollisionWarner uses an Asserter to notify the collision | 131 // The class ThreadCollisionWarner uses an Asserter to notify the collision |
132 // AsserterBase is the interfaces and DCheckAsserter is the default asserter | 132 // AsserterBase is the interfaces and DCheckAsserter is the default asserter |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // Here only for class unit tests purpose, during the test I need to not | 236 // Here only for class unit tests purpose, during the test I need to not |
237 // DCHECK but notify the collision with something else. | 237 // DCHECK but notify the collision with something else. |
238 AsserterBase* asserter_; | 238 AsserterBase* asserter_; |
239 | 239 |
240 DISALLOW_COPY_AND_ASSIGN(ThreadCollisionWarner); | 240 DISALLOW_COPY_AND_ASSIGN(ThreadCollisionWarner); |
241 }; | 241 }; |
242 | 242 |
243 } // namespace base | 243 } // namespace base |
244 | 244 |
245 #endif // BASE_THREADING_THREAD_COLLISION_WARNER_H_ | 245 #endif // BASE_THREADING_THREAD_COLLISION_WARNER_H_ |
OLD | NEW |