Chromium Code Reviews

Side by Side Diff: webrtc/system_wrappers/source/condition_variable_native_win.cc

Issue 1601743004: Make CriticalSectionWrapper non-virtual (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Improve comment Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
11 #include "webrtc/system_wrappers/include/trace.h" 12 #include "webrtc/system_wrappers/include/trace.h"
12 #include "webrtc/system_wrappers/source/condition_variable_native_win.h" 13 #include "webrtc/system_wrappers/source/condition_variable_native_win.h"
13 #include "webrtc/system_wrappers/source/critical_section_win.h"
14 14
15 namespace webrtc { 15 namespace webrtc {
16 16
17 static HMODULE library = NULL; 17 static HMODULE library = NULL;
18 static bool win_support_condition_variables_primitive = false; 18 static bool win_support_condition_variables_primitive = false;
19 19
20 PInitializeConditionVariable PInitializeConditionVariable_; 20 PInitializeConditionVariable PInitializeConditionVariable_;
21 PSleepConditionVariableCS PSleepConditionVariableCS_; 21 PSleepConditionVariableCS PSleepConditionVariableCS_;
22 PWakeConditionVariable PWakeConditionVariable_; 22 PWakeConditionVariable PWakeConditionVariable_;
23 PWakeAllConditionVariable PWakeAllConditionVariable_; 23 PWakeAllConditionVariable PWakeAllConditionVariable_;
(...skipping 55 matching lines...)
79 PInitializeConditionVariable_(&condition_variable_); 79 PInitializeConditionVariable_(&condition_variable_);
80 return true; 80 return true;
81 } 81 }
82 82
83 void ConditionVariableNativeWin::SleepCS(CriticalSectionWrapper& crit_sect) { 83 void ConditionVariableNativeWin::SleepCS(CriticalSectionWrapper& crit_sect) {
84 SleepCS(crit_sect, INFINITE); 84 SleepCS(crit_sect, INFINITE);
85 } 85 }
86 86
87 bool ConditionVariableNativeWin::SleepCS(CriticalSectionWrapper& crit_sect, 87 bool ConditionVariableNativeWin::SleepCS(CriticalSectionWrapper& crit_sect,
88 unsigned long max_time_in_ms) { 88 unsigned long max_time_in_ms) {
89 CriticalSectionWindows* cs =
90 static_cast<CriticalSectionWindows*>(&crit_sect);
91 BOOL ret_val = PSleepConditionVariableCS_(&condition_variable_, 89 BOOL ret_val = PSleepConditionVariableCS_(&condition_variable_,
92 &(cs->crit), max_time_in_ms); 90 &crit_sect.crit_, max_time_in_ms);
93 return ret_val != 0; 91 return ret_val != 0;
94 } 92 }
95 93
96 void ConditionVariableNativeWin::Wake() { 94 void ConditionVariableNativeWin::Wake() {
97 PWakeConditionVariable_(&condition_variable_); 95 PWakeConditionVariable_(&condition_variable_);
98 } 96 }
99 97
100 void ConditionVariableNativeWin::WakeAll() { 98 void ConditionVariableNativeWin::WakeAll() {
101 PWakeAllConditionVariable_(&condition_variable_); 99 PWakeAllConditionVariable_(&condition_variable_);
102 } 100 }
103 101
104 } // namespace webrtc 102 } // namespace webrtc
OLDNEW

Powered by Google App Engine