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 #include "webrtc/call/rtc_event_log_helper_thread.h" | 11 #include "webrtc/logging/rtc_event_log/rtc_event_log_helper_thread.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 | 14 |
15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
16 #include "webrtc/system_wrappers/include/logging.h" | 16 #include "webrtc/system_wrappers/include/logging.h" |
17 | 17 |
18 #ifdef ENABLE_RTC_EVENT_LOG | 18 #ifdef ENABLE_RTC_EVENT_LOG |
19 | 19 |
20 namespace webrtc { | 20 namespace webrtc { |
21 | 21 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // We can't destroy the event log until we have stopped the thread, | 67 // We can't destroy the event log until we have stopped the thread, |
68 // so clear the message queue and try again. Note that if we clear | 68 // so clear the message queue and try again. Note that if we clear |
69 // any STOP_FILE events, then the threads calling StopLogging would likely | 69 // any STOP_FILE events, then the threads calling StopLogging would likely |
70 // wait indefinitely. However, there should not be any such calls as we | 70 // wait indefinitely. However, there should not be any such calls as we |
71 // are executing the destructor. | 71 // are executing the destructor. |
72 LOG(LS_WARNING) << "Clearing message queue to terminate thread."; | 72 LOG(LS_WARNING) << "Clearing message queue to terminate thread."; |
73 message_queue_->Clear(); | 73 message_queue_->Clear(); |
74 } | 74 } |
75 wake_from_hibernation_.Set(); | 75 wake_from_hibernation_.Set(); |
76 wake_periodically_.Set(); // Wake up the output thread. | 76 wake_periodically_.Set(); // Wake up the output thread. |
77 thread_.Stop(); // Wait for the thread to terminate. | 77 thread_.Stop(); // Wait for the thread to terminate. |
78 } | 78 } |
79 | 79 |
80 void RtcEventLogHelperThread::WaitForFileFinished() { | 80 void RtcEventLogHelperThread::WaitForFileFinished() { |
81 wake_from_hibernation_.Set(); | 81 wake_from_hibernation_.Set(); |
82 wake_periodically_.Set(); | 82 wake_periodically_.Set(); |
83 file_finished_.Wait(rtc::Event::kForever); | 83 file_finished_.Wait(rtc::Event::kForever); |
84 } | 84 } |
85 | 85 |
86 void RtcEventLogHelperThread::SignalNewEvent() { | 86 void RtcEventLogHelperThread::SignalNewEvent() { |
87 wake_from_hibernation_.Set(); | 87 wake_from_hibernation_.Set(); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 311 |
312 bool RtcEventLogHelperThread::ThreadOutputFunction(void* obj) { | 312 bool RtcEventLogHelperThread::ThreadOutputFunction(void* obj) { |
313 RtcEventLogHelperThread* helper = static_cast<RtcEventLogHelperThread*>(obj); | 313 RtcEventLogHelperThread* helper = static_cast<RtcEventLogHelperThread*>(obj); |
314 helper->ProcessEvents(); | 314 helper->ProcessEvents(); |
315 return false; | 315 return false; |
316 } | 316 } |
317 | 317 |
318 } // namespace webrtc | 318 } // namespace webrtc |
319 | 319 |
320 #endif // ENABLE_RTC_EVENT_LOG | 320 #endif // ENABLE_RTC_EVENT_LOG |
OLD | NEW |