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 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/synchronization/lock_impl.h" | 9 #include "base/synchronization/lock_impl.h" |
10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 void AssertAcquired() const; | 58 void AssertAcquired() const; |
59 #endif // NDEBUG && !DCHECK_ALWAYS_ON | 59 #endif // NDEBUG && !DCHECK_ALWAYS_ON |
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 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; | |
70 #endif | 66 #endif |
71 | 67 |
72 private: | 68 private: |
73 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) | 69 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) |
74 // Members and routines taking care of locks assertions. | 70 // Members and routines taking care of locks assertions. |
75 // Note that this checks for recursive locks and allows them | 71 // Note that this checks for recursive locks and allows them |
76 // if the variable is set. This is allowed by the underlying implementation | 72 // if the variable is set. This is allowed by the underlying implementation |
77 // on windows but not on Posix, so we're doing unneeded checks on Posix. | 73 // on windows but not on Posix, so we're doing unneeded checks on Posix. |
78 // It's worth it to share the code. | 74 // It's worth it to share the code. |
79 void CheckHeldAndUnmark(); | 75 void CheckHeldAndUnmark(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 124 } |
129 | 125 |
130 private: | 126 private: |
131 Lock& lock_; | 127 Lock& lock_; |
132 DISALLOW_COPY_AND_ASSIGN(AutoUnlock); | 128 DISALLOW_COPY_AND_ASSIGN(AutoUnlock); |
133 }; | 129 }; |
134 | 130 |
135 } // namespace base | 131 } // namespace base |
136 | 132 |
137 #endif // BASE_SYNCHRONIZATION_LOCK_H_ | 133 #endif // BASE_SYNCHRONIZATION_LOCK_H_ |
OLD | NEW |