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

Side by Side Diff: content/renderer/media/webrtc/rtc_stats.h

Issue 2319543002: WebRTCStats added for surfacing RTCStats from WebRTC to Blink. (Closed)
Patch Set: Addressed comments Created 4 years, 3 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_RTC_STATS_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_RTC_STATS_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "third_party/WebKit/public/platform/WebRTCStats.h"
10 #include "third_party/webrtc/api/rtcstats.h"
11 #include "third_party/webrtc/api/rtcstatsreport.h"
12
13 namespace content {
14
15 class RTCStats : public blink::WebRTCStats {
16 public:
17 RTCStats(scoped_refptr<const webrtc::RTCStatsReport> stats_owner,
18 const webrtc::RTCStats* stats);
19 ~RTCStats() override;
20
21 blink::WebString id() const override;
22 blink::WebString type() const override;
23 double timestamp() const override;
24
25 size_t membersCount() const override;
26 // The member is valid as long as this |RTCStats| object is alive. Do not use
27 // the member object after this object is destroyed.
28 std::unique_ptr<blink::WebRTCStatsMember> getMember(size_t i) const override;
29
30 private:
31 // |stats_| are owned by |stats_owner_|, keeping a reference to the owning
32 // report protects it from destruction.
33 scoped_refptr<const webrtc::RTCStatsReport> stats_owner_;
34 const webrtc::RTCStats* stats_;
35 // Members of |stats_|, same as |stats_->Members()|.
36 std::vector<const webrtc::RTCStatsMemberInterface*> members_;
37 };
38
39 class RTCStatsMember : public blink::WebRTCStatsMember {
40 public:
41 RTCStatsMember(const webrtc::RTCStatsMemberInterface* member);
42
43 blink::WebString name() const override;
44 blink::WebRTCStatsMemberType type() const override;
45
46 int32_t valueInt32() const override;
47 uint32_t valueUint32() const override;
48 int64_t valueInt64() const override;
49 uint64_t valueUint64() const override;
50 double valueDouble() const override;
51 const char* valueStaticString() const override;
52 const std::string& valueString() const override;
53 const std::vector<int32_t>& valueSequenceInt32() const override;
54 const std::vector<uint32_t>& valueSequenceUint32() const override;
55 const std::vector<int64_t>& valueSequenceInt64() const override;
56 const std::vector<uint64_t>& valueSequenceUint64() const override;
57 const std::vector<double>& valueSequenceDouble() const override;
58 const std::vector<const char*>& valueSequenceStaticString() const override;
59 const std::vector<std::string>& valueSequenceString() const override;
60
61 private:
62 // Owned by the stats whose member this is. Not to be used after the
63 // |RTCStats| that constructed this object is destroyed.
64 const webrtc::RTCStatsMemberInterface* member_;
65 };
66
67 } // namespace content
68
69 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_RTC_STATS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698