OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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/condition_variable_wrapper.h" | 11 #include "webrtc/system_wrappers/include/condition_variable_wrapper.h" |
12 | 12 |
13 #if defined(_WIN32) | 13 // TODO(tommi): Remove completely. As is there is still some code for Windows |
| 14 // that relies on ConditionVariableWrapper, but code has been removed on other |
| 15 // platforms. |
| 16 #if defined(WEBRTC_WIN) |
| 17 |
14 #include <windows.h> | 18 #include <windows.h> |
15 #include "webrtc/system_wrappers/source/condition_variable_event_win.h" | 19 #include "webrtc/system_wrappers/source/condition_variable_event_win.h" |
16 #include "webrtc/system_wrappers/source/condition_variable_native_win.h" | 20 #include "webrtc/system_wrappers/source/condition_variable_native_win.h" |
17 #elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) | |
18 #include <pthread.h> | |
19 #include "webrtc/system_wrappers/source/condition_variable_posix.h" | |
20 #endif | |
21 | 21 |
22 namespace webrtc { | 22 namespace webrtc { |
23 | |
24 ConditionVariableWrapper* ConditionVariableWrapper::CreateConditionVariable() { | 23 ConditionVariableWrapper* ConditionVariableWrapper::CreateConditionVariable() { |
25 #if defined(_WIN32) | |
26 // Try to create native condition variable implementation. | 24 // Try to create native condition variable implementation. |
27 ConditionVariableWrapper* ret_val = ConditionVariableNativeWin::Create(); | 25 ConditionVariableWrapper* ret_val = ConditionVariableNativeWin::Create(); |
28 if (!ret_val) { | 26 if (!ret_val) { |
29 // Native condition variable implementation does not exist. Create generic | 27 // Native condition variable implementation does not exist. Create generic |
30 // condition variable based on events. | 28 // condition variable based on events. |
31 ret_val = new ConditionVariableEventWin(); | 29 ret_val = new ConditionVariableEventWin(); |
32 } | 30 } |
33 return ret_val; | 31 return ret_val; |
34 #elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) | |
35 return ConditionVariablePosix::Create(); | |
36 #else | |
37 return NULL; | |
38 #endif | |
39 } | 32 } |
| 33 } // namespace webrtc |
40 | 34 |
41 } // namespace webrtc | 35 #endif // defined(WEBRTC_WIN) |
OLD | NEW |