Index: webrtc/stats/rtcstats.cc |
diff --git a/webrtc/stats/rtcstats.cc b/webrtc/stats/rtcstats.cc |
index 543ef420139512c32f428ce3ef0dd23a4dacdf82..0edd1deb8529f66813fcad55d447927edd21415c 100644 |
--- a/webrtc/stats/rtcstats.cc |
+++ b/webrtc/stats/rtcstats.cc |
@@ -48,6 +48,27 @@ std::string VectorOfStringsToString(const std::vector<T>& strings) { |
} // namespace |
+bool RTCStats::operator==(const RTCStats& other) const { |
+ if (type() != other.type()) |
+ return false; |
+ 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
|
+ std::vector<const RTCStatsMemberInterface*> other_members = other.Members(); |
+ RTC_DCHECK_EQ(members.size(), other_members.size()); |
+ for (size_t i = 0; i < members.size(); ++i) { |
+ const RTCStatsMemberInterface* member = members[i]; |
+ const RTCStatsMemberInterface* other_member = other_members[i]; |
+ RTC_DCHECK_EQ(member->type(), other_member->type()); |
+ RTC_DCHECK_EQ(member->name(), other_member->name()); |
+ if (*member != *other_member) |
+ return false; |
+ } |
+ return true; |
+} |
+ |
+bool RTCStats::operator!=(const RTCStats& other) const { |
+ return !(*this == other); |
+} |
+ |
std::string RTCStats::ToString() const { |
std::ostringstream oss; |
oss << type() << " {\n id: \"" << id_ << "\"\n timestamp: " |