summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/stats/attribute.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libwebrtc/stats/attribute.cc')
-rw-r--r--third_party/libwebrtc/stats/attribute.cc19
1 files changed, 8 insertions, 11 deletions
diff --git a/third_party/libwebrtc/stats/attribute.cc b/third_party/libwebrtc/stats/attribute.cc
index fab948b1bd..cf49cb2311 100644
--- a/third_party/libwebrtc/stats/attribute.cc
+++ b/third_party/libwebrtc/stats/attribute.cc
@@ -25,12 +25,12 @@ namespace {
struct VisitIsSequence {
// Any type of vector is a sequence.
template <typename T>
- bool operator()(const RTCStatsMember<std::vector<T>>* attribute) {
+ bool operator()(const absl::optional<std::vector<T>>* attribute) {
return true;
}
// Any other type is not.
template <typename T>
- bool operator()(const RTCStatsMember<T>* attribute) {
+ bool operator()(const absl::optional<T>* attribute) {
return false;
}
};
@@ -62,7 +62,7 @@ struct VisitToString {
// Vector attributes.
template <typename T>
- std::string operator()(const RTCStatsMember<std::vector<T>>* attribute) {
+ std::string operator()(const absl::optional<std::vector<T>>* attribute) {
rtc::StringBuilder sb;
sb << "[";
const char* separator = "";
@@ -84,7 +84,7 @@ struct VisitToString {
// Map attributes.
template <typename T>
std::string operator()(
- const RTCStatsMember<std::map<std::string, T>>* attribute) {
+ const absl::optional<std::map<std::string, T>>* attribute) {
rtc::StringBuilder sb;
sb << "{";
const char* separator = "";
@@ -106,21 +106,18 @@ struct VisitToString {
}
// Simple attributes.
template <typename T>
- std::string operator()(const RTCStatsMember<T>* attribute) {
+ std::string operator()(const absl::optional<T>* attribute) {
return ValueToString(attribute->value());
}
};
struct VisitIsEqual {
template <typename T>
- bool operator()(const RTCStatsMember<T>* attribute) {
+ bool operator()(const absl::optional<T>* attribute) {
if (!other.holds_alternative<T>()) {
return false;
}
- absl::optional<T> attribute_as_optional =
- attribute->has_value() ? absl::optional<T>(attribute->value())
- : absl::nullopt;
- return attribute_as_optional == other.as_optional<T>();
+ return *attribute == other.as_optional<T>();
}
const Attribute& other;
@@ -146,7 +143,7 @@ bool Attribute::is_sequence() const {
}
bool Attribute::is_string() const {
- return absl::holds_alternative<const RTCStatsMember<std::string>*>(
+ return absl::holds_alternative<const absl::optional<std::string>*>(
attribute_);
}