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

Unified Diff: webrtc/logging/rtc_event_log/rtc_event_log_helper_thread.cc

Issue 2515653002: Convert rtc_event_log from webrtc::Clock to rtc::TimeMicros. (Closed)
Patch Set: Rebase. Created 4 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 side-by-side diff with in-line comments
Download patch
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..e7edd9a93c07d86f40fe6be07a73872a91e2e01e 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_, rtc::TimeMicros()));
end_event.set_type(rtclog::Event::LOG_END);
AppendEventToString(&end_event);
« no previous file with comments | « webrtc/logging/rtc_event_log/rtc_event_log_helper_thread.h ('k') | webrtc/logging/rtc_event_log/rtc_event_log_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698