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

Side by Side Diff: webrtc/system_wrappers/source/event_timer_posix.h

Issue 1469013002: Move ThreadWrapper to ProcessThread in base. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: removed comment Created 5 years 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
OLDNEW
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 #ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_EVENT_POSIX_H_ 11 #ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_EVENT_POSIX_H_
12 #define WEBRTC_SYSTEM_WRAPPERS_SOURCE_EVENT_POSIX_H_ 12 #define WEBRTC_SYSTEM_WRAPPERS_SOURCE_EVENT_POSIX_H_
13 13
14 #include "webrtc/system_wrappers/include/event_wrapper.h" 14 #include "webrtc/system_wrappers/include/event_wrapper.h"
15 15
16 #include <pthread.h> 16 #include <pthread.h>
17 #include <time.h> 17 #include <time.h>
18 18
19 #include "webrtc/system_wrappers/include/thread_wrapper.h" 19 #include "webrtc/base/platform_thread.h"
20 20
21 namespace webrtc { 21 namespace webrtc {
22 22
23 enum State { 23 enum State {
24 kUp = 1, 24 kUp = 1,
25 kDown = 2 25 kDown = 2
26 }; 26 };
27 27
28 class EventTimerPosix : public EventTimerWrapper { 28 class EventTimerPosix : public EventTimerWrapper {
29 public: 29 public:
30 EventTimerPosix(); 30 EventTimerPosix();
31 ~EventTimerPosix() override; 31 ~EventTimerPosix() override;
32 32
33 EventTypeWrapper Wait(unsigned long max_time) override; 33 EventTypeWrapper Wait(unsigned long max_time) override;
34 bool Set() override; 34 bool Set() override;
35 35
36 bool StartTimer(bool periodic, unsigned long time) override; 36 bool StartTimer(bool periodic, unsigned long time) override;
37 bool StopTimer() override; 37 bool StopTimer() override;
38 38
39 private: 39 private:
40 static bool Run(void* obj); 40 static bool Run(void* obj);
41 bool Process(); 41 bool Process();
42 EventTypeWrapper Wait(timespec* end_at); 42 EventTypeWrapper Wait(timespec* end_at);
43 43
44 private: 44 private:
45 pthread_cond_t cond_; 45 pthread_cond_t cond_;
46 pthread_mutex_t mutex_; 46 pthread_mutex_t mutex_;
47 bool event_set_; 47 bool event_set_;
48 48
49 rtc::scoped_ptr<ThreadWrapper> timer_thread_; 49 rtc::scoped_ptr<PlatformThread> timer_thread_;
50 rtc::scoped_ptr<EventTimerPosix> timer_event_; 50 rtc::scoped_ptr<EventTimerPosix> timer_event_;
51 timespec created_at_; 51 timespec created_at_;
52 52
53 bool periodic_; 53 bool periodic_;
54 unsigned long time_; // In ms 54 unsigned long time_; // In ms
55 unsigned long count_; 55 unsigned long count_;
56 }; 56 };
57 57
58 } // namespace webrtc 58 } // namespace webrtc
59 59
60 #endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_EVENT_POSIX_H_ 60 #endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_EVENT_POSIX_H_
OLDNEW
« no previous file with comments | « webrtc/system_wrappers/source/data_log.cc ('k') | webrtc/system_wrappers/source/event_timer_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698