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

Unified Diff: webrtc/stats/rtcstatsreport.cc

Issue 2593503003: RTCStatsReport::AddStats DCHECKs that the ID is unique. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « webrtc/api/stats/rtcstatsreport.h ('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 3dd6eff39fc43518f7d615cf3c67e5ba7af68913..566aef8772de09d18103123d8a9a17082e523bac 100644
--- a/webrtc/stats/rtcstatsreport.cc
+++ b/webrtc/stats/rtcstatsreport.cc
@@ -69,9 +69,12 @@ RTCStatsReport::RTCStatsReport(int64_t timestamp_us)
RTCStatsReport::~RTCStatsReport() {
}
-bool RTCStatsReport::AddStats(std::unique_ptr<const RTCStats> stats) {
- return !stats_.insert(std::make_pair(std::string(stats->id()),
- std::move(stats))).second;
+void RTCStatsReport::AddStats(std::unique_ptr<const RTCStats> stats) {
+ auto result = stats_.insert(std::make_pair(std::string(stats->id()),
+ std::move(stats)));
+ RTC_DCHECK(result.second) <<
+ "A stats object with ID " << result.first->second->id() << " is already "
+ "present in this stats report.";
}
const RTCStats* RTCStatsReport::Get(const std::string& id) const {
« no previous file with comments | « webrtc/api/stats/rtcstatsreport.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698