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

Unified Diff: third_party/WebKit/Source/modules/peerconnection/RTCStatsResponse.cpp

Issue 2186853002: WebRTCStats added, retaining type info when surfacing WebRTC stats into Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed tommi's comments Created 4 years, 5 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
Index: third_party/WebKit/Source/modules/peerconnection/RTCStatsResponse.cpp
diff --git a/third_party/WebKit/Source/modules/peerconnection/RTCStatsResponse.cpp b/third_party/WebKit/Source/modules/peerconnection/RTCStatsResponse.cpp
index 65345212f254d9b4efd13140ced542c33716b9b4..33ff72fd8d4a189244c9e98d4ca09220e8ade6c2 100644
--- a/third_party/WebKit/Source/modules/peerconnection/RTCStatsResponse.cpp
+++ b/third_party/WebKit/Source/modules/peerconnection/RTCStatsResponse.cpp
@@ -42,17 +42,15 @@ RTCLegacyStatsReport* RTCStatsResponse::namedItem(const AtomicString& name)
return nullptr;
}
-size_t RTCStatsResponse::addReport(const String& id, const String& type, double timestamp)
+void RTCStatsResponse::addStats(const WebRTCStats& stats)
{
- m_result.append(RTCLegacyStatsReport::create(id, type, timestamp));
- m_idmap.add(id, m_result.size() - 1);
- return m_result.size() - 1;
-}
+ m_result.append(RTCLegacyStatsReport::create(stats.id(), stats.typeToString(), stats.timestamp()));
+ m_idmap.add(stats.id(), m_result.size() - 1);
+ RTCLegacyStatsReport* report = m_result[m_result.size() - 1].get();
-void RTCStatsResponse::addStatistic(size_t report, const String& name, const String& value)
-{
- SECURITY_DCHECK(report >= 0 && report < m_result.size());
- m_result[report]->addStatistic(name, value);
+ for (std::unique_ptr<WebRTCStatsMemberIterator> member(stats.iterator()); !member->isEnd(); member->next()) {
+ report->addStatistic(member->displayName(), member->valueToString());
+ }
}
DEFINE_TRACE(RTCStatsResponse)

Powered by Google App Engine
This is Rietveld 408576698