Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: base/synchronization/condition_variable_win.cc

Issue 403803004: base: Enable lock dchecks with dchecks_always_on (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix condition variable too Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_.native_handle(); 100 CRITICAL_SECTION* cs = user_lock_.lock_.native_handle();
101 101
102 #if !defined(NDEBUG) 102 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
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) || defined(DCHECK_ALWAYS_ON)
111 user_lock_.CheckUnheldAndMark(); 111 user_lock_.CheckUnheldAndMark();
112 #endif 112 #endif
113 } 113 }
114 114
115 void WinVistaCondVar::Broadcast() { 115 void WinVistaCondVar::Broadcast() {
116 wake_all_condition_variable_fn(&cv_); 116 wake_all_condition_variable_fn(&cv_);
117 } 117 }
118 118
119 void WinVistaCondVar::Signal() { 119 void WinVistaCondVar::Signal() {
120 wake_condition_variable_fn(&cv_); 120 wake_condition_variable_fn(&cv_);
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698