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

Unified Diff: webrtc/stats/rtcstats.cc

Issue 2441543002: RTCStats equality operator added (Closed)
Patch Set: Addressed comments and rebase with master Created 4 years, 2 months 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
« no previous file with comments | « webrtc/api/stats/rtcstats.h ('k') | webrtc/stats/rtcstats_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/stats/rtcstats.cc
diff --git a/webrtc/stats/rtcstats.cc b/webrtc/stats/rtcstats.cc
index 543ef420139512c32f428ce3ef0dd23a4dacdf82..fb9740a12e894581666cfe7ee4bbd328df45b7bf 100644
--- a/webrtc/stats/rtcstats.cc
+++ b/webrtc/stats/rtcstats.cc
@@ -48,6 +48,29 @@ std::string VectorOfStringsToString(const std::vector<T>& strings) {
} // namespace
+bool RTCStats::operator==(const RTCStats& other) const {
+ if (type() != other.type() || id() != other.id() ||
+ timestamp_us() != other.timestamp_us()) {
+ return false;
+ }
+ std::vector<const RTCStatsMemberInterface*> members = Members();
+ 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: "
« no previous file with comments | « webrtc/api/stats/rtcstats.h ('k') | webrtc/stats/rtcstats_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698