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

Side by Side Diff: webrtc/api/rtcstatsreport.h

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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/stats/BUILD.gn » ('j') | webrtc/stats/rtcstatsreport.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 static rtc::scoped_refptr<RTCStatsReport> Create(); 52 static rtc::scoped_refptr<RTCStatsReport> Create();
53 53
54 RTCStatsReport(); 54 RTCStatsReport();
55 RTCStatsReport(const RTCStatsReport& other) = delete; 55 RTCStatsReport(const RTCStatsReport& other) = delete;
56 56
57 bool AddStats(std::unique_ptr<const RTCStats> stats); 57 bool AddStats(std::unique_ptr<const RTCStats> stats);
58 const RTCStats* operator[](const std::string& id) const; 58 const RTCStats* operator[](const std::string& id) const;
59 size_t size() const { return stats_.size(); } 59 size_t size() const { return stats_.size(); }
60 60
61 // Takes ownership of all the stats in |victim|, leaving it empty.
62 void Scavenge(rtc::scoped_refptr<RTCStatsReport> victim);
hta-webrtc 2016/08/24 13:54:55 Suggest using less carnivorous language - what abo
hbos 2016/08/24 15:01:29 NomNomNom(victim) could have worked too. But OK, T
63
61 ConstIterator begin() const; 64 ConstIterator begin() const;
62 ConstIterator end() const; 65 ConstIterator end() const;
63 66
64 // Gets the subset of stats that are of type |T|, where |T| is any class 67 // Gets the subset of stats that are of type |T|, where |T| is any class
65 // descending from |RTCStats|. 68 // descending from |RTCStats|.
66 template<typename T> 69 template<typename T>
67 std::vector<const T*> GetStatsOfType() const { 70 std::vector<const T*> GetStatsOfType() const {
68 std::vector<const T*> stats_of_type; 71 std::vector<const T*> stats_of_type;
69 for (const RTCStats& stats : *this) { 72 for (const RTCStats& stats : *this) {
70 if (stats.type() == T::kType) 73 if (stats.type() == T::kType)
71 stats_of_type.push_back(&stats.cast_to<const T>()); 74 stats_of_type.push_back(&stats.cast_to<const T>());
72 } 75 }
73 return stats_of_type; 76 return stats_of_type;
74 } 77 }
75 78
76 friend class rtc::RefCountedObject<RTCStatsReport>; 79 friend class rtc::RefCountedObject<RTCStatsReport>;
77 80
78 private: 81 private:
79 ~RTCStatsReport() override; 82 ~RTCStatsReport() override;
80 83
81 StatsMap stats_; 84 StatsMap stats_;
82 }; 85 };
83 86
84 } // namespace webrtc 87 } // namespace webrtc
85 88
86 #endif // WEBRTC_API_RTCSTATSREPORT_H_ 89 #endif // WEBRTC_API_RTCSTATSREPORT_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/stats/BUILD.gn » ('j') | webrtc/stats/rtcstatsreport.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698