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

Unified Diff: webrtc/stats/rtcstatsreport.cc

Issue 2278433003: RTCStatsReport: Take ownership of other's stats with TakeMembersFrom (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 4 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: webrtc/stats/rtcstatsreport.cc
diff --git a/webrtc/stats/rtcstatsreport.cc b/webrtc/stats/rtcstatsreport.cc
index 870651d2dfc52b1afff2bda5f227ee57274c34ed..dc7a9917e54e6dc4931ac47602030dd001ef1562 100644
--- a/webrtc/stats/rtcstatsreport.cc
+++ b/webrtc/stats/rtcstatsreport.cc
@@ -73,6 +73,14 @@ const RTCStats* RTCStatsReport::operator[](const std::string& id) const {
return nullptr;
}
+void RTCStatsReport::Scavenge(rtc::scoped_refptr<RTCStatsReport> victim) {
+ for (StatsMap::iterator it = victim->stats_.begin();
+ it != victim->stats_.end(); ++it) {
+ AddStats(std::unique_ptr<const RTCStats>(it->second.release()));
+ }
+ victim->stats_.clear();
+}
+
RTCStatsReport::ConstIterator RTCStatsReport::begin() const {
return ConstIterator(rtc::scoped_refptr<const RTCStatsReport>(this),
stats_.cbegin());

Powered by Google App Engine
This is Rietveld 408576698