Chromium Code Reviews| 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 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 swap(lhs.max_size_bytes, rhs.max_size_bytes); | 61 swap(lhs.max_size_bytes, rhs.max_size_bytes); |
| 62 swap(lhs.start_time, rhs.start_time); | 62 swap(lhs.start_time, rhs.start_time); |
| 63 swap(lhs.stop_time, rhs.stop_time); | 63 swap(lhs.stop_time, rhs.stop_time); |
| 64 } | 64 } |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 RtcEventLogHelperThread( | 67 RtcEventLogHelperThread( |
| 68 SwapQueue<ControlMessage>* message_queue, | 68 SwapQueue<ControlMessage>* message_queue, |
| 69 SwapQueue<std::unique_ptr<rtclog::Event>>* event_queue, | 69 SwapQueue<std::unique_ptr<rtclog::Event>>* event_queue, |
| 70 rtc::Event* wake_up, | 70 rtc::Event* wake_up, |
| 71 rtc::Event* end_hibernation, | |
| 71 rtc::Event* file_finished, | 72 rtc::Event* file_finished, |
| 72 const Clock* const clock); | 73 const Clock* const clock); |
| 73 ~RtcEventLogHelperThread(); | 74 ~RtcEventLogHelperThread(); |
| 74 | 75 |
| 75 private: | 76 private: |
| 76 static bool ThreadOutputFunction(void* obj); | 77 static bool ThreadOutputFunction(void* obj); |
| 77 | 78 |
| 78 void TerminateThread(); | |
| 79 bool AppendEventToString(rtclog::Event* event); | 79 bool AppendEventToString(rtclog::Event* event); |
| 80 void AppendEventToHistory(const rtclog::Event& event); | 80 int LogToMemory(); |
|
pbos-webrtc
2016/06/03 08:56:15
size_t or preferably just a bool for whether it su
terelius
2016/06/08 11:47:29
Changed to bool.
| |
| 81 void LogToMemory(); | |
| 82 void StartLogFile(); | 81 void StartLogFile(); |
| 83 void LogToFile(); | 82 int LogToFile(); |
| 84 void StopLogFile(); | 83 void StopLogFile(); |
| 85 void WriteLog(); | 84 void ProcessEvents(); |
| 86 | 85 |
| 87 // Message queues for passing events to the logging thread. | 86 // Message queues for passing events to the logging thread. |
| 88 SwapQueue<ControlMessage>* message_queue_; | 87 SwapQueue<ControlMessage>* message_queue_; |
| 89 SwapQueue<std::unique_ptr<rtclog::Event>>* event_queue_; | 88 SwapQueue<std::unique_ptr<rtclog::Event>>* event_queue_; |
| 90 | 89 |
| 91 // History containing the most recent events (~ 10 s). | 90 // History containing the most recent events (~ 10 s). |
| 92 RingBuffer<std::unique_ptr<rtclog::Event>> history_; | 91 RingBuffer<std::unique_ptr<rtclog::Event>> history_; |
| 93 | 92 |
| 94 // History containing all past configuration events. | 93 // History containing all past configuration events. |
| 95 std::vector<std::unique_ptr<rtclog::Event>> config_history_; | 94 std::vector<std::unique_ptr<rtclog::Event>> config_history_; |
| 96 | 95 |
| 97 std::unique_ptr<FileWrapper> file_; | 96 std::unique_ptr<FileWrapper> file_; |
| 98 rtc::PlatformThread thread_; | 97 rtc::PlatformThread thread_; |
| 99 | 98 |
| 100 int64_t max_size_bytes_; | 99 int64_t max_size_bytes_; |
| 101 int64_t written_bytes_; | 100 int64_t written_bytes_; |
| 102 int64_t start_time_; | 101 int64_t start_time_; |
| 103 int64_t stop_time_; | 102 int64_t stop_time_; |
| 104 | 103 |
| 105 bool has_recent_event_; | 104 bool has_recent_event_; |
| 106 std::unique_ptr<rtclog::Event> most_recent_event_; | 105 std::unique_ptr<rtclog::Event> most_recent_event_; |
| 107 | 106 |
| 108 // Temporary space for serializing profobuf data. | 107 // Temporary space for serializing profobuf data. |
| 109 std::string output_string_; | 108 std::string output_string_; |
| 110 | 109 |
| 111 rtc::Event* wake_up_; | 110 rtc::Event* wake_up_; |
| 111 rtc::Event* end_hibernation_; | |
|
pbos-webrtc
2016/06/03 08:51:06
Shouldn't the wake_up_ event be sufficient to sign
terelius
2016/06/08 11:47:29
Both are needed. I renamed them wake_periodically_
| |
| 112 rtc::Event* stopped_; | 112 rtc::Event* stopped_; |
| 113 | 113 |
| 114 const Clock* const clock_; | 114 const Clock* const clock_; |
| 115 | 115 |
| 116 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtcEventLogHelperThread); | 116 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtcEventLogHelperThread); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 } // namespace webrtc | 119 } // namespace webrtc |
| 120 | 120 |
| 121 #endif // ENABLE_RTC_EVENT_LOG | 121 #endif // ENABLE_RTC_EVENT_LOG |
| 122 | 122 |
| 123 #endif // WEBRTC_CALL_RTC_EVENT_LOG_HELPER_THREAD_H_ | 123 #endif // WEBRTC_CALL_RTC_EVENT_LOG_HELPER_THREAD_H_ |
| OLD | NEW |