Chromium Code Reviews| Index: webrtc/logging/rtc_event_log/rtc_event_log_helper_thread.cc |
| diff --git a/webrtc/logging/rtc_event_log/rtc_event_log_helper_thread.cc b/webrtc/logging/rtc_event_log/rtc_event_log_helper_thread.cc |
| index 4d55da354230ff806d8683504b79aa68a24b992f..5c300abe1ade6f734e816d7e78570e6b76aca58d 100644 |
| --- a/webrtc/logging/rtc_event_log/rtc_event_log_helper_thread.cc |
| +++ b/webrtc/logging/rtc_event_log/rtc_event_log_helper_thread.cc |
| @@ -13,6 +13,7 @@ |
| #include <algorithm> |
| #include "webrtc/base/checks.h" |
| +#include "webrtc/base/timeutils.h" |
| #include "webrtc/system_wrappers/include/logging.h" |
| #ifdef ENABLE_RTC_EVENT_LOG |
| @@ -34,8 +35,7 @@ bool IsConfigEvent(const rtclog::Event& event) { |
| // RtcEventLogImpl member functions. |
| RtcEventLogHelperThread::RtcEventLogHelperThread( |
| SwapQueue<ControlMessage>* message_queue, |
| - SwapQueue<std::unique_ptr<rtclog::Event>>* event_queue, |
| - const Clock* const clock) |
| + SwapQueue<std::unique_ptr<rtclog::Event>>* event_queue) |
| : message_queue_(message_queue), |
| event_queue_(event_queue), |
| history_(kEventsInHistory), |
| @@ -51,18 +51,16 @@ RtcEventLogHelperThread::RtcEventLogHelperThread( |
| output_string_(), |
| wake_periodically_(false, false), |
| wake_from_hibernation_(false, false), |
| - file_finished_(false, false), |
| - clock_(clock) { |
| + file_finished_(false, false) { |
| RTC_DCHECK(message_queue_); |
| RTC_DCHECK(event_queue_); |
| - RTC_DCHECK(clock_); |
| thread_.Start(); |
| } |
| RtcEventLogHelperThread::~RtcEventLogHelperThread() { |
| ControlMessage message; |
| message.message_type = ControlMessage::TERMINATE_THREAD; |
| - message.stop_time = clock_->TimeInMicroseconds(); |
| + message.stop_time = rtc::TimeMicros(); |
| while (!message_queue_->Insert(&message)) { |
| // We can't destroy the event log until we have stopped the thread, |
| // so clear the message queue and try again. Note that if we clear |
| @@ -112,7 +110,7 @@ bool RtcEventLogHelperThread::LogToMemory() { |
| // Process each event earlier than the current time and append it to the |
| // appropriate history_. |
| - int64_t current_time = clock_->TimeInMicroseconds(); |
| + int64_t current_time = rtc::TimeMicros(); |
| if (!has_recent_event_) { |
| has_recent_event_ = event_queue_->Remove(&most_recent_event_); |
| } |
| @@ -180,7 +178,7 @@ bool RtcEventLogHelperThread::LogToFile() { |
| // Append each event older than both the current time and the stop time |
| // to the output_string_. |
| - int64_t current_time = clock_->TimeInMicroseconds(); |
| + int64_t current_time = rtc::TimeMicros(); |
| int64_t time_limit = std::min(current_time, stop_time_); |
| if (!has_recent_event_) { |
| has_recent_event_ = event_queue_->Remove(&most_recent_event_); |
| @@ -228,7 +226,7 @@ void RtcEventLogHelperThread::StopLogFile() { |
| // or because we have reached the log file size limit. Therefore, use the |
| // current time if we have not reached the time limit. |
| end_event.set_timestamp_us( |
| - std::min(stop_time_, clock_->TimeInMicroseconds())); |
| + std::min(stop_time_, static_cast<int64_t>(rtc::TimeMicros()))); |
|
the sun
2016/11/18 15:43:59
Oh, so theoretically, the other calls to rtc::Time
nisse-webrtc
2016/11/21 07:58:02
I'll try to land https://codereview.webrtc.org/251
nisse-webrtc
2016/11/28 14:26:41
Deleting the cast now.
|
| end_event.set_type(rtclog::Event::LOG_END); |
| AppendEventToString(&end_event); |