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

Unified Diff: webrtc/stats/rtcstatsreport.cc

Issue 2983243002: Make RTCStatsReport::ToString() return JSON-parseable string. (Closed)
Patch Set: Add test. Created 3 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
« webrtc/stats/rtcstats_unittest.cc ('K') | « webrtc/stats/rtcstats_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/stats/rtcstatsreport.cc
diff --git a/webrtc/stats/rtcstatsreport.cc b/webrtc/stats/rtcstatsreport.cc
index 566aef8772de09d18103123d8a9a17082e523bac..f6736d1f91a93ce6cfbfb0e3faa4dfb8ceb7c45d 100644
--- a/webrtc/stats/rtcstatsreport.cc
+++ b/webrtc/stats/rtcstatsreport.cc
@@ -107,10 +107,11 @@ std::string RTCStatsReport::ToString() const {
std::ostringstream oss;
ConstIterator it = begin();
if (it != end()) {
- oss << it->ToString();
+ oss << '[' << it->ToString();
for (++it; it != end(); ++it) {
- oss << '\n' << it->ToString();
+ oss << ",\n" << it->ToString();
}
+ oss << ']';
hbos 2017/07/25 12:29:21 Is it valid JSON to have just an array, and not a
}
return oss.str();
}
« webrtc/stats/rtcstats_unittest.cc ('K') | « webrtc/stats/rtcstats_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698