| 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 #include "base/synchronization/condition_variable.h" | 5 #include "base/synchronization/condition_variable.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <stack> | 8 #include <stack> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 /////////////////////////////////////////////////////////////////////////////// | 68 /////////////////////////////////////////////////////////////////////////////// |
| 69 // Windows Vista and Win7 implementation. | 69 // Windows Vista and Win7 implementation. |
| 70 /////////////////////////////////////////////////////////////////////////////// | 70 /////////////////////////////////////////////////////////////////////////////// |
| 71 | 71 |
| 72 class WinVistaCondVar: public ConditionVarImpl { | 72 class WinVistaCondVar: public ConditionVarImpl { |
| 73 public: | 73 public: |
| 74 WinVistaCondVar(Lock* user_lock); | 74 WinVistaCondVar(Lock* user_lock); |
| 75 ~WinVistaCondVar() {}; | 75 ~WinVistaCondVar() {}; |
| 76 // Overridden from ConditionVarImpl. | 76 // Overridden from ConditionVarImpl. |
| 77 virtual void Wait() OVERRIDE; | 77 void Wait() override; |
| 78 virtual void TimedWait(const TimeDelta& max_time) OVERRIDE; | 78 void TimedWait(const TimeDelta& max_time) override; |
| 79 virtual void Broadcast() OVERRIDE; | 79 void Broadcast() override; |
| 80 virtual void Signal() OVERRIDE; | 80 void Signal() override; |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 base::Lock& user_lock_; | 83 base::Lock& user_lock_; |
| 84 CONDITION_VARIABLE cv_; | 84 CONDITION_VARIABLE cv_; |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 WinVistaCondVar::WinVistaCondVar(Lock* user_lock) | 87 WinVistaCondVar::WinVistaCondVar(Lock* user_lock) |
| 88 : user_lock_(*user_lock) { | 88 : user_lock_(*user_lock) { |
| 89 initialize_condition_variable_fn(&cv_); | 89 initialize_condition_variable_fn(&cv_); |
| 90 DCHECK(user_lock); | 90 DCHECK(user_lock); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 /////////////////////////////////////////////////////////////////////////////// | 123 /////////////////////////////////////////////////////////////////////////////// |
| 124 // Windows XP implementation. | 124 // Windows XP implementation. |
| 125 /////////////////////////////////////////////////////////////////////////////// | 125 /////////////////////////////////////////////////////////////////////////////// |
| 126 | 126 |
| 127 class WinXPCondVar : public ConditionVarImpl { | 127 class WinXPCondVar : public ConditionVarImpl { |
| 128 public: | 128 public: |
| 129 WinXPCondVar(Lock* user_lock); | 129 WinXPCondVar(Lock* user_lock); |
| 130 ~WinXPCondVar(); | 130 ~WinXPCondVar(); |
| 131 // Overridden from ConditionVarImpl. | 131 // Overridden from ConditionVarImpl. |
| 132 virtual void Wait() OVERRIDE; | 132 void Wait() override; |
| 133 virtual void TimedWait(const TimeDelta& max_time) OVERRIDE; | 133 void TimedWait(const TimeDelta& max_time) override; |
| 134 virtual void Broadcast() OVERRIDE; | 134 void Broadcast() override; |
| 135 virtual void Signal() OVERRIDE; | 135 void Signal() override; |
| 136 | 136 |
| 137 // Define Event class that is used to form circularly linked lists. | 137 // Define Event class that is used to form circularly linked lists. |
| 138 // The list container is an element with NULL as its handle_ value. | 138 // The list container is an element with NULL as its handle_ value. |
| 139 // The actual list elements have a non-zero handle_ value. | 139 // The actual list elements have a non-zero handle_ value. |
| 140 // All calls to methods MUST be done under protection of a lock so that links | 140 // All calls to methods MUST be done under protection of a lock so that links |
| 141 // can be validated. Without the lock, some links might asynchronously | 141 // can be validated. Without the lock, some links might asynchronously |
| 142 // change, and the assertions would fail (as would list change operations). | 142 // change, and the assertions would fail (as would list change operations). |
| 143 class Event { | 143 class Event { |
| 144 public: | 144 public: |
| 145 // Default constructor with no arguments creates a list container. | 145 // Default constructor with no arguments creates a list container. |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 | 660 |
| 661 void ConditionVariable::Broadcast() { | 661 void ConditionVariable::Broadcast() { |
| 662 impl_->Broadcast(); | 662 impl_->Broadcast(); |
| 663 } | 663 } |
| 664 | 664 |
| 665 void ConditionVariable::Signal() { | 665 void ConditionVariable::Signal() { |
| 666 impl_->Signal(); | 666 impl_->Signal(); |
| 667 } | 667 } |
| 668 | 668 |
| 669 } // namespace base | 669 } // namespace base |
| OLD | NEW |