OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 rtc::scoped_refptr<const RTCStatsReport> report_; | 48 rtc::scoped_refptr<const RTCStatsReport> report_; |
49 StatsMap::const_iterator it_; | 49 StatsMap::const_iterator it_; |
50 }; | 50 }; |
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* Get(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 TakeMembersFrom(rtc::scoped_refptr<RTCStatsReport> victim); |
| 63 |
| 64 // Stats iterators. Stats are ordered lexicographically on |RTCStats::id|. |
61 ConstIterator begin() const; | 65 ConstIterator begin() const; |
62 ConstIterator end() const; | 66 ConstIterator end() const; |
63 | 67 |
64 // Gets the subset of stats that are of type |T|, where |T| is any class | 68 // Gets the subset of stats that are of type |T|, where |T| is any class |
65 // descending from |RTCStats|. | 69 // descending from |RTCStats|. |
66 template<typename T> | 70 template<typename T> |
67 std::vector<const T*> GetStatsOfType() const { | 71 std::vector<const T*> GetStatsOfType() const { |
68 std::vector<const T*> stats_of_type; | 72 std::vector<const T*> stats_of_type; |
69 for (const RTCStats& stats : *this) { | 73 for (const RTCStats& stats : *this) { |
70 if (stats.type() == T::kType) | 74 if (stats.type() == T::kType) |
71 stats_of_type.push_back(&stats.cast_to<const T>()); | 75 stats_of_type.push_back(&stats.cast_to<const T>()); |
72 } | 76 } |
73 return stats_of_type; | 77 return stats_of_type; |
74 } | 78 } |
75 | 79 |
76 friend class rtc::RefCountedObject<RTCStatsReport>; | 80 friend class rtc::RefCountedObject<RTCStatsReport>; |
77 | 81 |
78 private: | 82 private: |
79 ~RTCStatsReport() override; | 83 ~RTCStatsReport() override; |
80 | 84 |
81 StatsMap stats_; | 85 StatsMap stats_; |
82 }; | 86 }; |
83 | 87 |
84 } // namespace webrtc | 88 } // namespace webrtc |
85 | 89 |
86 #endif // WEBRTC_API_RTCSTATSREPORT_H_ | 90 #endif // WEBRTC_API_RTCSTATSREPORT_H_ |
OLD | NEW |