blob: 006aa2e95bca790fcfcb1054ad63cd8d74b9d5b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_RENDERER_MEDIA_WEBRTC_RTC_STATS_H_
#define CONTENT_RENDERER_MEDIA_WEBRTC_RTC_STATS_H_
#include "base/memory/ref_counted.h"
#include "content/common/content_export.h"
#include "third_party/WebKit/public/platform/WebRTCStats.h"
#include "third_party/webrtc/api/stats/rtcstats.h"
#include "third_party/webrtc/api/stats/rtcstatsreport.h"
namespace content {
class CONTENT_EXPORT RTCStatsReport : public blink::WebRTCStatsReport {
public:
RTCStatsReport(
const scoped_refptr<const webrtc::RTCStatsReport>& stats_report);
~RTCStatsReport() override;
std::unique_ptr<blink::WebRTCStatsReport> CopyHandle() const override;
std::unique_ptr<blink::WebRTCStats> GetStats(
blink::WebString id) const override;
std::unique_ptr<blink::WebRTCStats> Next() override;
size_t Size() const override;
private:
const scoped_refptr<const webrtc::RTCStatsReport> stats_report_;
webrtc::RTCStatsReport::ConstIterator it_;
const webrtc::RTCStatsReport::ConstIterator end_;
};
class CONTENT_EXPORT RTCStats : public blink::WebRTCStats {
public:
RTCStats(const scoped_refptr<const webrtc::RTCStatsReport>& stats_owner,
const webrtc::RTCStats* stats);
~RTCStats() override;
blink::WebString Id() const override;
blink::WebString GetType() const override;
double Timestamp() const override;
size_t MembersCount() const override;
std::unique_ptr<blink::WebRTCStatsMember> GetMember(size_t i) const override;
private:
// Reference to keep the report that owns |stats_| alive.
const scoped_refptr<const webrtc::RTCStatsReport> stats_owner_;
// Pointer to a stats object that is owned by |stats_owner_|.
const webrtc::RTCStats* const stats_;
// Members of the |stats_| object, equivalent to |stats_->Members()|.
const std::vector<const webrtc::RTCStatsMemberInterface*> stats_members_;
};
class CONTENT_EXPORT RTCStatsMember : public blink::WebRTCStatsMember {
public:
RTCStatsMember(const scoped_refptr<const webrtc::RTCStatsReport>& stats_owner,
const webrtc::RTCStatsMemberInterface* member);
~RTCStatsMember() override;
blink::WebString GetName() const override;
blink::WebRTCStatsMemberType GetType() const override;
bool IsDefined() const override;
bool ValueBool() const override;
int32_t ValueInt32() const override;
uint32_t ValueUint32() const override;
int64_t ValueInt64() const override;
uint64_t ValueUint64() const override;
double ValueDouble() const override;
blink::WebString ValueString() const override;
blink::WebVector<int> ValueSequenceBool() const override;
blink::WebVector<int32_t> ValueSequenceInt32() const override;
blink::WebVector<uint32_t> ValueSequenceUint32() const override;
blink::WebVector<int64_t> ValueSequenceInt64() const override;
blink::WebVector<uint64_t> ValueSequenceUint64() const override;
blink::WebVector<double> ValueSequenceDouble() const override;
blink::WebVector<blink::WebString> ValueSequenceString() const override;
private:
// Reference to keep the report that owns |member_|'s stats object alive.
const scoped_refptr<const webrtc::RTCStatsReport> stats_owner_;
// Pointer to member of a stats object that is owned by |stats_owner_|.
const webrtc::RTCStatsMemberInterface* const member_;
};
CONTENT_EXPORT void WhitelistStatsForTesting(const char* type);
} // namespace content
#endif // CONTENT_RENDERER_MEDIA_WEBRTC_RTC_STATS_H_
|