| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 DCHECK(user_lock); | 90 DCHECK(user_lock); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void WinVistaCondVar::Wait() { | 93 void WinVistaCondVar::Wait() { |
| 94 TimedWait(TimeDelta::FromMilliseconds(INFINITE)); | 94 TimedWait(TimeDelta::FromMilliseconds(INFINITE)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void WinVistaCondVar::TimedWait(const TimeDelta& max_time) { | 97 void WinVistaCondVar::TimedWait(const TimeDelta& max_time) { |
| 98 base::ThreadRestrictions::AssertWaitAllowed(); | 98 base::ThreadRestrictions::AssertWaitAllowed(); |
| 99 DWORD timeout = static_cast<DWORD>(max_time.InMilliseconds()); | 99 DWORD timeout = static_cast<DWORD>(max_time.InMilliseconds()); |
| 100 CRITICAL_SECTION* cs = user_lock_.lock_.os_lock(); | 100 CRITICAL_SECTION* cs = user_lock_.lock_.native_handle(); |
| 101 | 101 |
| 102 #if !defined(NDEBUG) | 102 #if !defined(NDEBUG) |
| 103 user_lock_.CheckHeldAndUnmark(); | 103 user_lock_.CheckHeldAndUnmark(); |
| 104 #endif | 104 #endif |
| 105 | 105 |
| 106 if (FALSE == sleep_condition_variable_fn(&cv_, cs, timeout)) { | 106 if (FALSE == sleep_condition_variable_fn(&cv_, cs, timeout)) { |
| 107 DCHECK(GetLastError() != WAIT_TIMEOUT); | 107 DCHECK(GetLastError() != WAIT_TIMEOUT); |
| 108 } | 108 } |
| 109 | 109 |
| 110 #if !defined(NDEBUG) | 110 #if !defined(NDEBUG) |
| (...skipping 549 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 |