OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/media/webrtc_logging_message_data.h" | 5 #include "chrome/common/media/webrtc_logging_message_data.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
8 | 10 |
9 WebRtcLoggingMessageData::WebRtcLoggingMessageData() {} | 11 WebRtcLoggingMessageData::WebRtcLoggingMessageData() {} |
10 | 12 |
11 WebRtcLoggingMessageData::WebRtcLoggingMessageData(base::Time time, | 13 WebRtcLoggingMessageData::WebRtcLoggingMessageData(base::Time time, |
12 const std::string& message) | 14 const std::string& message) |
13 : timestamp(time), message(message) {} | 15 : timestamp(time), message(message) {} |
14 | 16 |
15 // static | 17 // static |
16 std::string WebRtcLoggingMessageData::Format(const std::string& message, | 18 std::string WebRtcLoggingMessageData::Format(const std::string& message, |
17 base::Time timestamp, | 19 base::Time timestamp, |
18 base::Time start_time) { | 20 base::Time start_time) { |
19 int32 interval_ms = | 21 int32_t interval_ms = |
20 static_cast<int32>((timestamp - start_time).InMilliseconds()); | 22 static_cast<int32_t>((timestamp - start_time).InMilliseconds()); |
21 return base::StringPrintf("[%03d:%03d] %s", interval_ms / 1000, | 23 return base::StringPrintf("[%03d:%03d] %s", interval_ms / 1000, |
22 interval_ms % 1000, message.c_str()); | 24 interval_ms % 1000, message.c_str()); |
23 } | 25 } |
24 | 26 |
25 std::string WebRtcLoggingMessageData::Format(base::Time start_time) const { | 27 std::string WebRtcLoggingMessageData::Format(base::Time start_time) const { |
26 return Format(message, timestamp, start_time); | 28 return Format(message, timestamp, start_time); |
27 } | 29 } |
OLD | NEW |