OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 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 30 matching lines...) Expand all Loading... | |
41 oss << "{ \"" << rtc::ToString<T>(strings[0]) << '\"'; | 41 oss << "{ \"" << rtc::ToString<T>(strings[0]) << '\"'; |
42 for (size_t i = 1; i < strings.size(); ++i) { | 42 for (size_t i = 1; i < strings.size(); ++i) { |
43 oss << ", \"" << rtc::ToString<T>(strings[i]) << '\"'; | 43 oss << ", \"" << rtc::ToString<T>(strings[i]) << '\"'; |
44 } | 44 } |
45 oss << " }"; | 45 oss << " }"; |
46 return oss.str(); | 46 return oss.str(); |
47 } | 47 } |
48 | 48 |
49 } // namespace | 49 } // namespace |
50 | 50 |
51 bool RTCStats::operator==(const RTCStats& other) const { | |
52 if (type() != other.type()) | |
53 return false; | |
54 std::vector<const RTCStatsMemberInterface*> members = Members(); | |
hta-webrtc
2016/10/21 08:56:01
What about the id and the timestamp?
Are they sig
hbos_chromium
2016/10/21 18:59:18
They should also be compared too, fixed that. Done
| |
55 std::vector<const RTCStatsMemberInterface*> other_members = other.Members(); | |
56 RTC_DCHECK_EQ(members.size(), other_members.size()); | |
57 for (size_t i = 0; i < members.size(); ++i) { | |
58 const RTCStatsMemberInterface* member = members[i]; | |
59 const RTCStatsMemberInterface* other_member = other_members[i]; | |
60 RTC_DCHECK_EQ(member->type(), other_member->type()); | |
61 RTC_DCHECK_EQ(member->name(), other_member->name()); | |
62 if (*member != *other_member) | |
63 return false; | |
64 } | |
65 return true; | |
66 } | |
67 | |
68 bool RTCStats::operator!=(const RTCStats& other) const { | |
69 return !(*this == other); | |
70 } | |
71 | |
51 std::string RTCStats::ToString() const { | 72 std::string RTCStats::ToString() const { |
52 std::ostringstream oss; | 73 std::ostringstream oss; |
53 oss << type() << " {\n id: \"" << id_ << "\"\n timestamp: " | 74 oss << type() << " {\n id: \"" << id_ << "\"\n timestamp: " |
54 << timestamp_us_ << '\n'; | 75 << timestamp_us_ << '\n'; |
55 for (const RTCStatsMemberInterface* member : Members()) { | 76 for (const RTCStatsMemberInterface* member : Members()) { |
56 oss << " " << member->name() << ": "; | 77 oss << " " << member->name() << ": "; |
57 if (member->is_defined()) { | 78 if (member->is_defined()) { |
58 if (member->is_string()) | 79 if (member->is_string()) |
59 oss << '"' << member->ValueToString() << "\"\n"; | 80 oss << '"' << member->ValueToString() << "\"\n"; |
60 else | 81 else |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 std::vector<uint64_t>, kSequenceUint64, true, false, | 144 std::vector<uint64_t>, kSequenceUint64, true, false, |
124 VectorToString(value_)); | 145 VectorToString(value_)); |
125 WEBRTC_DEFINE_RTCSTATSMEMBER( | 146 WEBRTC_DEFINE_RTCSTATSMEMBER( |
126 std::vector<double>, kSequenceDouble, true, false, | 147 std::vector<double>, kSequenceDouble, true, false, |
127 VectorToString(value_)); | 148 VectorToString(value_)); |
128 WEBRTC_DEFINE_RTCSTATSMEMBER( | 149 WEBRTC_DEFINE_RTCSTATSMEMBER( |
129 std::vector<std::string>, kSequenceString, true, false, | 150 std::vector<std::string>, kSequenceString, true, false, |
130 VectorOfStringsToString(value_)); | 151 VectorOfStringsToString(value_)); |
131 | 152 |
132 } // namespace webrtc | 153 } // namespace webrtc |
OLD | NEW |