OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_HELPER_THREAD_H_ | 11 #ifndef WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_HELPER_THREAD_H_ |
12 #define WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_HELPER_THREAD_H_ | 12 #define WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_HELPER_THREAD_H_ |
13 | 13 |
14 #include <limits> | 14 #include <limits> |
15 #include <memory> | 15 #include <memory> |
16 #include <string> | 16 #include <string> |
17 #include <utility> | 17 #include <utility> |
18 #include <vector> | 18 #include <vector> |
19 | 19 |
20 #include "webrtc/base/constructormagic.h" | 20 #include "webrtc/base/constructormagic.h" |
21 #include "webrtc/base/event.h" | 21 #include "webrtc/base/event.h" |
22 #include "webrtc/base/ignore_wundef.h" | 22 #include "webrtc/base/ignore_wundef.h" |
23 #include "webrtc/base/platform_thread.h" | 23 #include "webrtc/base/platform_thread.h" |
24 #include "webrtc/base/swap_queue.h" | 24 #include "webrtc/base/swap_queue.h" |
25 #include "webrtc/logging/rtc_event_log/ringbuffer.h" | 25 #include "webrtc/logging/rtc_event_log/ringbuffer.h" |
26 #include "webrtc/system_wrappers/include/clock.h" | |
27 #include "webrtc/system_wrappers/include/file_wrapper.h" | 26 #include "webrtc/system_wrappers/include/file_wrapper.h" |
28 | 27 |
29 #ifdef ENABLE_RTC_EVENT_LOG | 28 #ifdef ENABLE_RTC_EVENT_LOG |
30 // Files generated at build-time by the protobuf compiler. | 29 // Files generated at build-time by the protobuf compiler. |
31 RTC_PUSH_IGNORING_WUNDEF() | 30 RTC_PUSH_IGNORING_WUNDEF() |
32 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD | 31 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD |
33 #include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log.pb.h" | 32 #include "external/webrtc/webrtc/logging/rtc_event_log/rtc_event_log.pb.h" |
34 #else | 33 #else |
35 #include "webrtc/logging/rtc_event_log/rtc_event_log.pb.h" | 34 #include "webrtc/logging/rtc_event_log/rtc_event_log.pb.h" |
36 #endif | 35 #endif |
(...skipping 25 matching lines...) Expand all Loading... |
62 swap(lhs.message_type, rhs.message_type); | 61 swap(lhs.message_type, rhs.message_type); |
63 lhs.file.swap(rhs.file); | 62 lhs.file.swap(rhs.file); |
64 swap(lhs.max_size_bytes, rhs.max_size_bytes); | 63 swap(lhs.max_size_bytes, rhs.max_size_bytes); |
65 swap(lhs.start_time, rhs.start_time); | 64 swap(lhs.start_time, rhs.start_time); |
66 swap(lhs.stop_time, rhs.stop_time); | 65 swap(lhs.stop_time, rhs.stop_time); |
67 } | 66 } |
68 }; | 67 }; |
69 | 68 |
70 RtcEventLogHelperThread( | 69 RtcEventLogHelperThread( |
71 SwapQueue<ControlMessage>* message_queue, | 70 SwapQueue<ControlMessage>* message_queue, |
72 SwapQueue<std::unique_ptr<rtclog::Event>>* event_queue, | 71 SwapQueue<std::unique_ptr<rtclog::Event>>* event_queue); |
73 const Clock* const clock); | |
74 ~RtcEventLogHelperThread(); | 72 ~RtcEventLogHelperThread(); |
75 | 73 |
76 // This function MUST be called once a STOP_FILE message is added to the | 74 // This function MUST be called once a STOP_FILE message is added to the |
77 // signalling queue. The function will make sure that the output thread | 75 // signalling queue. The function will make sure that the output thread |
78 // wakes up to read the message, and it blocks until the output thread has | 76 // wakes up to read the message, and it blocks until the output thread has |
79 // finished writing to the file. | 77 // finished writing to the file. |
80 void WaitForFileFinished(); | 78 void WaitForFileFinished(); |
81 | 79 |
82 // This fuction MUST be called once an event is added to the event queue. | 80 // This fuction MUST be called once an event is added to the event queue. |
83 void SignalNewEvent(); | 81 void SignalNewEvent(); |
(...skipping 29 matching lines...) Expand all Loading... |
113 bool has_recent_event_; | 111 bool has_recent_event_; |
114 std::unique_ptr<rtclog::Event> most_recent_event_; | 112 std::unique_ptr<rtclog::Event> most_recent_event_; |
115 | 113 |
116 // Temporary space for serializing profobuf data. | 114 // Temporary space for serializing profobuf data. |
117 std::string output_string_; | 115 std::string output_string_; |
118 | 116 |
119 rtc::Event wake_periodically_; | 117 rtc::Event wake_periodically_; |
120 rtc::Event wake_from_hibernation_; | 118 rtc::Event wake_from_hibernation_; |
121 rtc::Event file_finished_; | 119 rtc::Event file_finished_; |
122 | 120 |
123 const Clock* const clock_; | |
124 | |
125 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtcEventLogHelperThread); | 121 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtcEventLogHelperThread); |
126 }; | 122 }; |
127 | 123 |
128 } // namespace webrtc | 124 } // namespace webrtc |
129 | 125 |
130 #endif // ENABLE_RTC_EVENT_LOG | 126 #endif // ENABLE_RTC_EVENT_LOG |
131 | 127 |
132 #endif // WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_HELPER_THREAD_H_ | 128 #endif // WEBRTC_LOGGING_RTC_EVENT_LOG_RTC_EVENT_LOG_HELPER_THREAD_H_ |
OLD | NEW |