| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_NON_THREAD_SAFE_H__ | 5 #ifndef BASE_NON_THREAD_SAFE_H__ |
| 6 #define BASE_NON_THREAD_SAFE_H__ | 6 #define BASE_NON_THREAD_SAFE_H__ |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/platform_thread.h" | 9 #include "base/platform_thread.h" |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // } | 25 // } |
| 26 // | 26 // |
| 27 // In Release mode, CalledOnValidThread will always return true. | 27 // In Release mode, CalledOnValidThread will always return true. |
| 28 // | 28 // |
| 29 #ifndef NDEBUG | 29 #ifndef NDEBUG |
| 30 class NonThreadSafe { | 30 class NonThreadSafe { |
| 31 public: | 31 public: |
| 32 NonThreadSafe(); | 32 NonThreadSafe(); |
| 33 ~NonThreadSafe(); | 33 ~NonThreadSafe(); |
| 34 | 34 |
| 35 protected: | |
| 36 bool CalledOnValidThread() const; | 35 bool CalledOnValidThread() const; |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 PlatformThreadId valid_thread_id_; | 38 PlatformThreadId valid_thread_id_; |
| 40 }; | 39 }; |
| 41 #else | 40 #else |
| 42 // Do nothing in release mode. | 41 // Do nothing in release mode. |
| 43 class NonThreadSafe { | 42 class NonThreadSafe { |
| 44 public: | 43 public: |
| 45 NonThreadSafe() {} | 44 NonThreadSafe() {} |
| 46 ~NonThreadSafe() {} | 45 ~NonThreadSafe() {} |
| 47 | 46 |
| 48 protected: | |
| 49 bool CalledOnValidThread() const { | 47 bool CalledOnValidThread() const { |
| 50 return true; | 48 return true; |
| 51 } | 49 } |
| 52 }; | 50 }; |
| 53 #endif // NDEBUG | 51 #endif // NDEBUG |
| 54 | 52 |
| 55 #endif // BASE_NON_THREAD_SAFE_H__ | 53 #endif // BASE_NON_THREAD_SAFE_H__ |
| 56 | 54 |
| OLD | NEW |