OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_TASK_SCHEDULER_SCHEDULER_LOCK_IMPL_H | 5 #ifndef BASE_TASK_SCHEDULER_SCHEDULER_LOCK_IMPL_H |
6 #define BASE_TASK_SCHEDULER_SCHEDULER_LOCK_IMPL_H | 6 #define BASE_TASK_SCHEDULER_SCHEDULER_LOCK_IMPL_H |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/base_export.h" | 10 #include "base/base_export.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 | 15 |
15 class ConditionVariable; | 16 class ConditionVariable; |
16 | 17 |
17 namespace internal { | 18 namespace internal { |
18 | 19 |
19 // A regular lock with simple deadlock correctness checking. | 20 // A regular lock with simple deadlock correctness checking. |
20 // This lock tracks all of the available locks to make sure that any locks are | 21 // This lock tracks all of the available locks to make sure that any locks are |
21 // acquired in an expected order. | 22 // acquired in an expected order. |
22 // See scheduler_lock.h for details. | 23 // See scheduler_lock.h for details. |
23 class BASE_EXPORT SchedulerLockImpl { | 24 class BASE_EXPORT SchedulerLockImpl { |
24 public: | 25 public: |
25 SchedulerLockImpl(); | 26 SchedulerLockImpl(); |
26 explicit SchedulerLockImpl(const SchedulerLockImpl* predecessor); | 27 explicit SchedulerLockImpl(const SchedulerLockImpl* predecessor); |
27 ~SchedulerLockImpl(); | 28 ~SchedulerLockImpl(); |
28 | 29 |
29 void Acquire(); | 30 void Acquire(); |
30 void Release(); | 31 void Release(); |
31 | 32 |
32 void AssertAcquired() const; | 33 void AssertAcquired() const; |
33 | 34 |
34 scoped_ptr<ConditionVariable> CreateConditionVariable(); | 35 std::unique_ptr<ConditionVariable> CreateConditionVariable(); |
35 | 36 |
36 private: | 37 private: |
37 Lock lock_; | 38 Lock lock_; |
38 | 39 |
39 DISALLOW_COPY_AND_ASSIGN(SchedulerLockImpl); | 40 DISALLOW_COPY_AND_ASSIGN(SchedulerLockImpl); |
40 }; | 41 }; |
41 | 42 |
42 } // namespace internal | 43 } // namespace internal |
43 } // namespace base | 44 } // namespace base |
44 | 45 |
45 #endif // BASE_TASK_SCHEDULER_SCHEDULER_LOCK_IMPL_H | 46 #endif // BASE_TASK_SCHEDULER_SCHEDULER_LOCK_IMPL_H |
OLD | NEW |