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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // ... | 72 // ... |
73 // void push(int) { DFAKE_SCOPED_LOCK_THREAD_LOCKED(push_pop_); ... } | 73 // void push(int) { DFAKE_SCOPED_LOCK_THREAD_LOCKED(push_pop_); ... } |
74 // int pop() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(push_pop_); ... } | 74 // int pop() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(push_pop_); ... } |
75 // ... | 75 // ... |
76 // private: | 76 // private: |
77 // DFAKE_MUTEX(push_pop_); | 77 // DFAKE_MUTEX(push_pop_); |
78 // }; | 78 // }; |
79 // | 79 // |
80 // | 80 // |
81 // Example: Class that has to be contructed/destroyed on same thread, it has | 81 // Example: Class that has to be contructed/destroyed on same thread, it has |
82 // a "shareable" method (with external syncronization) and a not | 82 // a "shareable" method (with external synchronization) and a not |
83 // shareable method (even with external synchronization). | 83 // shareable method (even with external synchronization). |
84 // | 84 // |
85 // In this case 3 Critical sections have to be defined | 85 // In this case 3 Critical sections have to be defined |
86 // | 86 // |
87 // class ExoticClass { | 87 // class ExoticClass { |
88 // public: | 88 // public: |
89 // ExoticClass() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... } | 89 // ExoticClass() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... } |
90 // ~ExoticClass() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... } | 90 // ~ExoticClass() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... } |
91 // | 91 // |
92 // void Shareable() { DFAKE_SCOPED_LOCK(shareable_section_); ... } | 92 // void Shareable() { DFAKE_SCOPED_LOCK(shareable_section_); ... } |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // Here only for class unit tests purpose, during the test I need to not | 235 // Here only for class unit tests purpose, during the test I need to not |
236 // DCHECK but notify the collision with something else. | 236 // DCHECK but notify the collision with something else. |
237 AsserterBase* asserter_; | 237 AsserterBase* asserter_; |
238 | 238 |
239 DISALLOW_COPY_AND_ASSIGN(ThreadCollisionWarner); | 239 DISALLOW_COPY_AND_ASSIGN(ThreadCollisionWarner); |
240 }; | 240 }; |
241 | 241 |
242 } // namespace base | 242 } // namespace base |
243 | 243 |
244 #endif // BASE_THREADING_THREAD_COLLISION_WARNER_H_ | 244 #endif // BASE_THREADING_THREAD_COLLISION_WARNER_H_ |
OLD | NEW |