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/event_wrapper.h" | 11 #include "webrtc/system_wrappers/include/event_wrapper.h" |
12 | 12 |
13 #if defined(_WIN32) | 13 #if defined(_WIN32) |
14 #include <windows.h> | 14 #include <windows.h> |
15 #include "webrtc/system_wrappers/source/event_timer_win.h" | 15 #include "webrtc/system_wrappers/source/event_timer_win.h" |
16 #elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) | 16 #elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) |
17 #include <ApplicationServices/ApplicationServices.h> | 17 #include <ApplicationServices/ApplicationServices.h> |
18 #include <pthread.h> | 18 #include <pthread.h> |
19 #include "webrtc/system_wrappers/source/event_timer_posix.h" | 19 #include "webrtc/system_wrappers/source/event_timer_posix.h" |
20 #else | 20 #else |
21 #include <pthread.h> | 21 #include <pthread.h> |
22 #include "webrtc/system_wrappers/source/event_timer_posix.h" | 22 #include "webrtc/system_wrappers/source/event_timer_posix.h" |
23 #endif | 23 #endif |
24 | 24 |
25 #include "webrtc/base/event.h" | 25 #include "webrtc/rtc_base/event.h" |
26 | 26 |
27 namespace webrtc { | 27 namespace webrtc { |
28 | 28 |
29 class EventWrapperImpl : public EventWrapper { | 29 class EventWrapperImpl : public EventWrapper { |
30 public: | 30 public: |
31 EventWrapperImpl() : event_(false, false) {} | 31 EventWrapperImpl() : event_(false, false) {} |
32 ~EventWrapperImpl() override {} | 32 ~EventWrapperImpl() override {} |
33 | 33 |
34 bool Set() override { | 34 bool Set() override { |
35 event_.Set(); | 35 event_.Set(); |
36 return true; | 36 return true; |
37 } | 37 } |
38 | 38 |
39 EventTypeWrapper Wait(unsigned long max_time) override { | 39 EventTypeWrapper Wait(unsigned long max_time) override { |
40 int to_wait = max_time == WEBRTC_EVENT_INFINITE ? | 40 int to_wait = max_time == WEBRTC_EVENT_INFINITE ? |
41 rtc::Event::kForever : static_cast<int>(max_time); | 41 rtc::Event::kForever : static_cast<int>(max_time); |
42 return event_.Wait(to_wait) ? kEventSignaled : kEventTimeout; | 42 return event_.Wait(to_wait) ? kEventSignaled : kEventTimeout; |
43 } | 43 } |
44 | 44 |
45 private: | 45 private: |
46 rtc::Event event_; | 46 rtc::Event event_; |
47 }; | 47 }; |
48 | 48 |
49 // static | 49 // static |
50 EventWrapper* EventWrapper::Create() { | 50 EventWrapper* EventWrapper::Create() { |
51 return new EventWrapperImpl(); | 51 return new EventWrapperImpl(); |
52 } | 52 } |
53 | 53 |
54 } // namespace webrtc | 54 } // namespace webrtc |
OLD | NEW |