| OLD | NEW |
| 1 // Copyright (c) 2006-2009 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_LOCK_H_ | 5 #ifndef BASE_LOCK_H_ |
| 6 #define BASE_LOCK_H_ | 6 #define BASE_LOCK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/lock_impl.h" | 9 #include "base/lock_impl.h" |
| 10 #include "base/platform_thread.h" |
| 10 | 11 |
| 11 // A convenient wrapper for an OS specific critical section. The only real | 12 // A convenient wrapper for an OS specific critical section. The only real |
| 12 // intelligence in this class is in debug mode for the support for the | 13 // intelligence in this class is in debug mode for the support for the |
| 13 // AssertAcquired() method. | 14 // AssertAcquired() method. |
| 14 | 15 |
| 15 class Lock { | 16 class Lock { |
| 16 public: | 17 public: |
| 17 #if defined(NDEBUG) // Optimized wrapper implementation | 18 #if defined(NDEBUG) // Optimized wrapper implementation |
| 18 Lock() : lock_() {} | 19 Lock() : lock_() {} |
| 19 ~Lock() {} | 20 ~Lock() {} |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 ~AutoUnlock() { | 118 ~AutoUnlock() { |
| 118 lock_.Acquire(); | 119 lock_.Acquire(); |
| 119 } | 120 } |
| 120 | 121 |
| 121 private: | 122 private: |
| 122 Lock& lock_; | 123 Lock& lock_; |
| 123 DISALLOW_COPY_AND_ASSIGN(AutoUnlock); | 124 DISALLOW_COPY_AND_ASSIGN(AutoUnlock); |
| 124 }; | 125 }; |
| 125 | 126 |
| 126 #endif // BASE_LOCK_H_ | 127 #endif // BASE_LOCK_H_ |
| OLD | NEW |