OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_RTC_STATS_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_RTC_STATS_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_RTC_STATS_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_RTC_STATS_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "content/common/content_export.h" |
9 #include "third_party/WebKit/public/platform/WebRTCStats.h" | 10 #include "third_party/WebKit/public/platform/WebRTCStats.h" |
10 #include "third_party/webrtc/api/stats/rtcstats.h" | 11 #include "third_party/webrtc/api/stats/rtcstats.h" |
11 #include "third_party/webrtc/api/stats/rtcstatsreport.h" | 12 #include "third_party/webrtc/api/stats/rtcstatsreport.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 | 15 |
15 class RTCStatsReport : public blink::WebRTCStatsReport { | 16 class CONTENT_EXPORT RTCStatsReport : public blink::WebRTCStatsReport { |
16 public: | 17 public: |
17 RTCStatsReport( | 18 RTCStatsReport( |
18 const scoped_refptr<const webrtc::RTCStatsReport>& stats_report); | 19 const scoped_refptr<const webrtc::RTCStatsReport>& stats_report); |
19 ~RTCStatsReport() override; | 20 ~RTCStatsReport() override; |
20 std::unique_ptr<blink::WebRTCStatsReport> copyHandle() const override; | 21 std::unique_ptr<blink::WebRTCStatsReport> copyHandle() const override; |
21 | 22 |
22 std::unique_ptr<blink::WebRTCStats> getStats( | 23 std::unique_ptr<blink::WebRTCStats> getStats( |
23 blink::WebString id) const override; | 24 blink::WebString id) const override; |
24 std::unique_ptr<blink::WebRTCStats> next() override; | 25 std::unique_ptr<blink::WebRTCStats> next() override; |
25 | 26 |
26 private: | 27 private: |
27 const scoped_refptr<const webrtc::RTCStatsReport> stats_report_; | 28 const scoped_refptr<const webrtc::RTCStatsReport> stats_report_; |
28 webrtc::RTCStatsReport::ConstIterator it_; | 29 webrtc::RTCStatsReport::ConstIterator it_; |
29 const webrtc::RTCStatsReport::ConstIterator end_; | 30 const webrtc::RTCStatsReport::ConstIterator end_; |
30 }; | 31 }; |
31 | 32 |
32 class RTCStats : public blink::WebRTCStats { | 33 class CONTENT_EXPORT RTCStats : public blink::WebRTCStats { |
33 public: | 34 public: |
34 RTCStats(const scoped_refptr<const webrtc::RTCStatsReport>& stats_owner, | 35 RTCStats(const scoped_refptr<const webrtc::RTCStatsReport>& stats_owner, |
35 const webrtc::RTCStats* stats); | 36 const webrtc::RTCStats* stats); |
36 ~RTCStats() override; | 37 ~RTCStats() override; |
37 | 38 |
38 blink::WebString id() const override; | 39 blink::WebString id() const override; |
39 blink::WebString type() const override; | 40 blink::WebString type() const override; |
40 double timestamp() const override; | 41 double timestamp() const override; |
41 | 42 |
42 size_t membersCount() const override; | 43 size_t membersCount() const override; |
43 std::unique_ptr<blink::WebRTCStatsMember> getMember(size_t i) const override; | 44 std::unique_ptr<blink::WebRTCStatsMember> getMember(size_t i) const override; |
44 | 45 |
45 private: | 46 private: |
46 // Reference to keep the report that owns |stats_| alive. | 47 // Reference to keep the report that owns |stats_| alive. |
47 const scoped_refptr<const webrtc::RTCStatsReport> stats_owner_; | 48 const scoped_refptr<const webrtc::RTCStatsReport> stats_owner_; |
48 // Pointer to a stats object that is owned by |stats_owner_|. | 49 // Pointer to a stats object that is owned by |stats_owner_|. |
49 const webrtc::RTCStats* const stats_; | 50 const webrtc::RTCStats* const stats_; |
50 // Members of the |stats_| object, equivalent to |stats_->Members()|. | 51 // Members of the |stats_| object, equivalent to |stats_->Members()|. |
51 const std::vector<const webrtc::RTCStatsMemberInterface*> stats_members_; | 52 const std::vector<const webrtc::RTCStatsMemberInterface*> stats_members_; |
52 }; | 53 }; |
53 | 54 |
54 class RTCStatsMember : public blink::WebRTCStatsMember { | 55 class CONTENT_EXPORT RTCStatsMember : public blink::WebRTCStatsMember { |
55 public: | 56 public: |
56 RTCStatsMember(const scoped_refptr<const webrtc::RTCStatsReport>& stats_owner, | 57 RTCStatsMember(const scoped_refptr<const webrtc::RTCStatsReport>& stats_owner, |
57 const webrtc::RTCStatsMemberInterface* member); | 58 const webrtc::RTCStatsMemberInterface* member); |
58 ~RTCStatsMember() override; | 59 ~RTCStatsMember() override; |
59 | 60 |
60 blink::WebString name() const override; | 61 blink::WebString name() const override; |
61 blink::WebRTCStatsMemberType type() const override; | 62 blink::WebRTCStatsMemberType type() const override; |
62 bool isDefined() const override; | 63 bool isDefined() const override; |
63 | 64 |
64 bool valueBool() const override; | 65 bool valueBool() const override; |
(...skipping 11 matching lines...) Expand all Loading... |
76 blink::WebVector<double> valueSequenceDouble() const override; | 77 blink::WebVector<double> valueSequenceDouble() const override; |
77 blink::WebVector<blink::WebString> valueSequenceString() const override; | 78 blink::WebVector<blink::WebString> valueSequenceString() const override; |
78 | 79 |
79 private: | 80 private: |
80 // Reference to keep the report that owns |member_|'s stats object alive. | 81 // Reference to keep the report that owns |member_|'s stats object alive. |
81 const scoped_refptr<const webrtc::RTCStatsReport> stats_owner_; | 82 const scoped_refptr<const webrtc::RTCStatsReport> stats_owner_; |
82 // Pointer to member of a stats object that is owned by |stats_owner_|. | 83 // Pointer to member of a stats object that is owned by |stats_owner_|. |
83 const webrtc::RTCStatsMemberInterface* const member_; | 84 const webrtc::RTCStatsMemberInterface* const member_; |
84 }; | 85 }; |
85 | 86 |
| 87 CONTENT_EXPORT void WhitelistStatsForTesting(const char* type); |
| 88 |
86 } // namespace content | 89 } // namespace content |
87 | 90 |
88 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_RTC_STATS_H_ | 91 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_RTC_STATS_H_ |
OLD | NEW |