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

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

Issue 2470703002: RTCOutboundRTPStreamStats added (re-land) (Closed)
Patch Set: Default argument for RTCStatsReport::Create Created 4 years, 1 month 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 | « webrtc/api/stats/rtcstats_objects.h ('k') | webrtc/stats/rtcstats.cc » ('j') | no next file with comments »
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 18 matching lines...) Expand all
29 typedef std::map<std::string, std::unique_ptr<const RTCStats>> StatsMap; 29 typedef std::map<std::string, std::unique_ptr<const RTCStats>> StatsMap;
30 30
31 class ConstIterator { 31 class ConstIterator {
32 public: 32 public:
33 ConstIterator(const ConstIterator&& other); 33 ConstIterator(const ConstIterator&& other);
34 ~ConstIterator(); 34 ~ConstIterator();
35 35
36 ConstIterator& operator++(); 36 ConstIterator& operator++();
37 ConstIterator& operator++(int); 37 ConstIterator& operator++(int);
38 const RTCStats& operator*() const; 38 const RTCStats& operator*() const;
39 const RTCStats* operator->() const;
39 bool operator==(const ConstIterator& other) const; 40 bool operator==(const ConstIterator& other) const;
40 bool operator!=(const ConstIterator& other) const; 41 bool operator!=(const ConstIterator& other) const;
41 42
42 private: 43 private:
43 friend class RTCStatsReport; 44 friend class RTCStatsReport;
44 ConstIterator(const rtc::scoped_refptr<const RTCStatsReport>& report, 45 ConstIterator(const rtc::scoped_refptr<const RTCStatsReport>& report,
45 StatsMap::const_iterator it); 46 StatsMap::const_iterator it);
46 47
47 // Reference report to make sure it is kept alive. 48 // Reference report to make sure it is kept alive.
48 rtc::scoped_refptr<const RTCStatsReport> report_; 49 rtc::scoped_refptr<const RTCStatsReport> report_;
49 StatsMap::const_iterator it_; 50 StatsMap::const_iterator it_;
50 }; 51 };
51 52
52 static rtc::scoped_refptr<RTCStatsReport> Create(); 53 // TODO(hbos): Remove "= 0" once Chromium unittest has been updated to call
54 // with a parameter. crbug.com/627816
55 static rtc::scoped_refptr<RTCStatsReport> Create(uint64_t timestamp_us = 0);
53 56
54 RTCStatsReport(); 57 explicit RTCStatsReport(uint64_t timestamp_us);
55 RTCStatsReport(const RTCStatsReport& other) = delete; 58 RTCStatsReport(const RTCStatsReport& other) = delete;
56 59
60 uint64_t timestamp_us() const { return timestamp_us_; }
57 bool AddStats(std::unique_ptr<const RTCStats> stats); 61 bool AddStats(std::unique_ptr<const RTCStats> stats);
58 const RTCStats* Get(const std::string& id) const; 62 const RTCStats* Get(const std::string& id) const;
59 size_t size() const { return stats_.size(); } 63 size_t size() const { return stats_.size(); }
60 64
61 // Takes ownership of all the stats in |victim|, leaving it empty. 65 // Takes ownership of all the stats in |victim|, leaving it empty.
62 void TakeMembersFrom(rtc::scoped_refptr<RTCStatsReport> victim); 66 void TakeMembersFrom(rtc::scoped_refptr<RTCStatsReport> victim);
63 67
64 // Stats iterators. Stats are ordered lexicographically on |RTCStats::id|. 68 // Stats iterators. Stats are ordered lexicographically on |RTCStats::id|.
65 ConstIterator begin() const; 69 ConstIterator begin() const;
66 ConstIterator end() const; 70 ConstIterator end() const;
67 71
68 // Gets the subset of stats that are of type |T|, where |T| is any class 72 // Gets the subset of stats that are of type |T|, where |T| is any class
69 // descending from |RTCStats|. 73 // descending from |RTCStats|.
70 template<typename T> 74 template<typename T>
71 std::vector<const T*> GetStatsOfType() const { 75 std::vector<const T*> GetStatsOfType() const {
72 std::vector<const T*> stats_of_type; 76 std::vector<const T*> stats_of_type;
73 for (const RTCStats& stats : *this) { 77 for (const RTCStats& stats : *this) {
74 if (stats.type() == T::kType) 78 if (stats.type() == T::kType)
75 stats_of_type.push_back(&stats.cast_to<const T>()); 79 stats_of_type.push_back(&stats.cast_to<const T>());
76 } 80 }
77 return stats_of_type; 81 return stats_of_type;
78 } 82 }
79 83
84 // Creates a human readable string representation of the report, listing all
85 // of its stats objects.
86 std::string ToString() const;
87
80 friend class rtc::RefCountedObject<RTCStatsReport>; 88 friend class rtc::RefCountedObject<RTCStatsReport>;
81 89
82 private: 90 private:
83 ~RTCStatsReport() override; 91 ~RTCStatsReport() override;
84 92
93 uint64_t timestamp_us_;
85 StatsMap stats_; 94 StatsMap stats_;
86 }; 95 };
87 96
88 } // namespace webrtc 97 } // namespace webrtc
89 98
90 #endif // WEBRTC_API_STATS_RTCSTATSREPORT_H_ 99 #endif // WEBRTC_API_STATS_RTCSTATSREPORT_H_
OLDNEW
« no previous file with comments | « webrtc/api/stats/rtcstats_objects.h ('k') | webrtc/stats/rtcstats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698