Index: webrtc/api/stats/rtcstats.h |
diff --git a/webrtc/api/stats/rtcstats.h b/webrtc/api/stats/rtcstats.h |
index 69175483021a748d8e4accd3239c4aa5ff256d79..eadbb449d1e4de6fb33a5859863e586a49f93fb8 100644 |
--- a/webrtc/api/stats/rtcstats.h |
+++ b/webrtc/api/stats/rtcstats.h |
@@ -63,8 +63,14 @@ class RTCStats { |
// Returns the static member variable |kType| of the implementing class. |
virtual const char* type() const = 0; |
// Returns a vector of pointers to all the RTCStatsMemberInterface members of |
- // this class. This allows for iteration of members. |
+ // this class. This allows for iteration of members. The member order must be |
+ // well-defined, the i-th member of two |RTCStats| objects of the same type |
+ // must correspond to the same member. |
hta-webrtc
2016/10/21 08:56:01
This is a reflection of the fact that the Members(
hbos_chromium
2016/10/21 18:59:18
Done.
|
std::vector<const RTCStatsMemberInterface*> Members() const; |
+ // Checks if the two stats objects are of the same type and have the same |
+ // member values. |
+ bool operator==(const RTCStats& other) const; |
+ bool operator!=(const RTCStats& other) const; |
// Creates a human readable string representation of the report, listing all |
// of its members (names and values). |
@@ -209,6 +215,11 @@ class RTCStatsMemberInterface { |
virtual bool is_sequence() const = 0; |
virtual bool is_string() const = 0; |
bool is_defined() const { return is_defined_; } |
+ // Type and value comparator (can be true even if name and type isn't). |
hta-webrtc
2016/10/21 08:56:01
Even if name and type isn't what?
hbos_chromium
2016/10/21 18:59:18
That was a bit nonsensey. Changed to "Type and val
|
+ virtual bool operator==(const RTCStatsMemberInterface& other) const = 0; |
+ bool operator!=(const RTCStatsMemberInterface& other) const { |
+ return !(*this == other); |
+ } |
virtual std::string ValueToString() const = 0; |
template<typename T> |
@@ -253,6 +264,15 @@ class RTCStatsMember : public RTCStatsMemberInterface { |
Type type() const override { return kType; } |
bool is_sequence() const override; |
bool is_string() const override; |
+ bool operator==(const RTCStatsMemberInterface& other) const override { |
+ if (type() != other.type()) |
+ return false; |
+ const RTCStatsMember<T>& other_t = |
+ static_cast<const RTCStatsMember<T>&>(other); |
+ if (!is_defined_) |
+ return !other_t.is_defined(); |
+ return value_ == other_t.value_; |
+ } |
hta-webrtc
2016/10/21 08:56:01
Didn't the presubmit check yell at you over having
hbos_chromium
2016/10/21 18:59:18
It does not, this is a template class.
|
std::string ValueToString() const override; |
// Assignment operators. |