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 #ifndef BASE_THREADING_NON_THREAD_SAFE_H_ | 5 #ifndef BASE_THREADING_NON_THREAD_SAFE_H_ |
6 #define BASE_THREADING_NON_THREAD_SAFE_H_ | 6 #define BASE_THREADING_NON_THREAD_SAFE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // Classes deriving from NonThreadSafe may need to suppress MSVC warning 4275: | 9 // Classes deriving from NonThreadSafe may need to suppress MSVC warning 4275: |
10 // non dll-interface class 'Bar' used as base for dll-interface class 'Foo'. | 10 // non dll-interface class 'Bar' used as base for dll-interface class 'Foo'. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // ... (do stuff) ... | 55 // ... (do stuff) ... |
56 // } | 56 // } |
57 // } | 57 // } |
58 // | 58 // |
59 // Note that base::ThreadChecker offers identical functionality to | 59 // Note that base::ThreadChecker offers identical functionality to |
60 // NonThreadSafe, but does not require inheritence. In general, it is preferable | 60 // NonThreadSafe, but does not require inheritence. In general, it is preferable |
61 // to have a base::ThreadChecker as a member, rather than inherit from | 61 // to have a base::ThreadChecker as a member, rather than inherit from |
62 // NonThreadSafe. For more details about when to choose one over the other, see | 62 // NonThreadSafe. For more details about when to choose one over the other, see |
63 // the documentation for base::ThreadChecker. | 63 // the documentation for base::ThreadChecker. |
64 #if ENABLE_NON_THREAD_SAFE | 64 #if ENABLE_NON_THREAD_SAFE |
65 class NonThreadSafe : public NonThreadSafeImpl { | 65 typedef NonThreadSafeImpl NonThreadSafe; |
66 }; | |
67 #else | 66 #else |
68 class NonThreadSafe : public NonThreadSafeDoNothing { | 67 typedef NonThreadSafeDoNothing NonThreadSafe; |
69 }; | |
70 #endif // ENABLE_NON_THREAD_SAFE | 68 #endif // ENABLE_NON_THREAD_SAFE |
71 | 69 |
72 #undef ENABLE_NON_THREAD_SAFE | 70 #undef ENABLE_NON_THREAD_SAFE |
73 | 71 |
74 } // namespace base | 72 } // namespace base |
75 | 73 |
76 #endif // BASE_NON_THREAD_SAFE_H_ | 74 #endif // BASE_NON_THREAD_SAFE_H_ |
OLD | NEW |