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_SYNCHRONIZATION_LOCK_H_ | 5 #ifndef BASE_SYNCHRONIZATION_LOCK_H_ |
6 #define BASE_SYNCHRONIZATION_LOCK_H_ | 6 #define BASE_SYNCHRONIZATION_LOCK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/base_export.h" | 9 #include "base/base_export.h" |
10 #include "base/synchronization/lock_impl.h" | 10 #include "base/synchronization/lock_impl.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 return rv; | 55 return rv; |
56 } | 56 } |
57 | 57 |
58 void AssertAcquired() const; | 58 void AssertAcquired() const; |
59 #endif // NDEBUG | 59 #endif // NDEBUG |
60 | 60 |
61 #if defined(OS_POSIX) | 61 #if defined(OS_POSIX) |
62 // The posix implementation of ConditionVariable needs to be able | 62 // The posix implementation of ConditionVariable needs to be able |
63 // to see our lock and tweak our debugging counters, as it releases | 63 // to see our lock and tweak our debugging counters, as it releases |
64 // and acquires locks inside of pthread_cond_{timed,}wait. | 64 // and acquires locks inside of pthread_cond_{timed,}wait. |
65 // Windows doesn't need to do this as it calls the Lock::* methods. | |
66 friend class ConditionVariable; | 65 friend class ConditionVariable; |
| 66 #elif defined(OS_WIN) |
| 67 // The Windows Vista implementation of ConditionVariable needs the |
| 68 // native handle of the critical section. |
| 69 friend class WinVistaCondVar; |
67 #endif | 70 #endif |
68 | 71 |
69 private: | 72 private: |
70 #if !defined(NDEBUG) | 73 #if !defined(NDEBUG) |
71 // Members and routines taking care of locks assertions. | 74 // Members and routines taking care of locks assertions. |
72 // Note that this checks for recursive locks and allows them | 75 // Note that this checks for recursive locks and allows them |
73 // if the variable is set. This is allowed by the underlying implementation | 76 // if the variable is set. This is allowed by the underlying implementation |
74 // on windows but not on Posix, so we're doing unneeded checks on Posix. | 77 // on windows but not on Posix, so we're doing unneeded checks on Posix. |
75 // It's worth it to share the code. | 78 // It's worth it to share the code. |
76 void CheckHeldAndUnmark(); | 79 void CheckHeldAndUnmark(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 126 } |
124 | 127 |
125 private: | 128 private: |
126 Lock& lock_; | 129 Lock& lock_; |
127 DISALLOW_COPY_AND_ASSIGN(AutoUnlock); | 130 DISALLOW_COPY_AND_ASSIGN(AutoUnlock); |
128 }; | 131 }; |
129 | 132 |
130 } // namespace base | 133 } // namespace base |
131 | 134 |
132 #endif // BASE_SYNCHRONIZATION_LOCK_H_ | 135 #endif // BASE_SYNCHRONIZATION_LOCK_H_ |
OLD | NEW |