| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_THREAD_CHECKER_H_ | 5 #ifndef BASE_THREADING_THREAD_CHECKER_H_ |
| 6 #define BASE_THREAD_CHECKER_H_ | 6 #define BASE_THREADING_THREAD_CHECKER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #ifndef NDEBUG | 9 #ifndef NDEBUG |
| 10 #include "base/lock.h" | 10 #include "base/lock.h" |
| 11 #include "base/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
| 12 #endif // NDEBUG | 12 #endif // NDEBUG |
| 13 | 13 |
| 14 namespace base { |
| 15 |
| 14 // Before using this class, please consider using NonThreadSafe as it | 16 // Before using this class, please consider using NonThreadSafe as it |
| 15 // makes it much easier to determine the nature of your class. | 17 // makes it much easier to determine the nature of your class. |
| 16 // | 18 // |
| 17 // A helper class used to help verify that some methods of a class are | 19 // A helper class used to help verify that some methods of a class are |
| 18 // called from the same thread. One can inherit from this class and use | 20 // called from the same thread. One can inherit from this class and use |
| 19 // CalledOnValidThread() to verify. | 21 // CalledOnValidThread() to verify. |
| 20 // | 22 // |
| 21 // Inheriting from class indicates that one must be careful when using the class | 23 // Inheriting from class indicates that one must be careful when using the class |
| 22 // with multiple threads. However, it is up to the class document to indicate | 24 // with multiple threads. However, it is up to the class document to indicate |
| 23 // how it can be used with threads. | 25 // how it can be used with threads. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 class ThreadChecker { | 61 class ThreadChecker { |
| 60 public: | 62 public: |
| 61 bool CalledOnValidThread() const { | 63 bool CalledOnValidThread() const { |
| 62 return true; | 64 return true; |
| 63 } | 65 } |
| 64 | 66 |
| 65 void DetachFromThread() {} | 67 void DetachFromThread() {} |
| 66 }; | 68 }; |
| 67 #endif // NDEBUG | 69 #endif // NDEBUG |
| 68 | 70 |
| 69 #endif // BASE_THREAD_CHECKER_H_ | 71 } // namespace base |
| 72 |
| 73 #endif // BASE_THREADING_THREAD_CHECKER_H_ |
| OLD | NEW |