Chromium Code Reviews| Index: webrtc/api/stats/rtcstats_objects.h |
| diff --git a/webrtc/api/stats/rtcstats_objects.h b/webrtc/api/stats/rtcstats_objects.h |
| index f816d48b55e62c5a9783b3fd35dcda10979b3eac..e827d011ea9499b3eff8fead60d3c03d8de5d1f8 100644 |
| --- a/webrtc/api/stats/rtcstats_objects.h |
| +++ b/webrtc/api/stats/rtcstats_objects.h |
| @@ -17,8 +17,57 @@ |
| namespace webrtc { |
| +// https://www.w3.org/TR/webrtc/#rtcicecandidatetype-enum |
| +struct RTCIceCandidateType { |
| + static const char* kHost; |
| + static const char* kSrflx; |
| + static const char* kPrflx; |
| + static const char* kRelay; |
| +}; |
| + |
| +// https://w3c.github.io/webrtc-stats/#icecandidate-dict* |
| +class RTCIceCandidateStats : public RTCStats { |
| + public: |
| + WEBRTC_RTCSTATS_DECL(); |
| + |
| + RTCIceCandidateStats(const RTCIceCandidateStats& other); |
| + ~RTCIceCandidateStats() override; |
| + |
| + RTCStatsMember<std::string> ip; |
| + RTCStatsMember<int32_t> port; |
| + RTCStatsMember<std::string> protocol; |
| + // TODO(hbos): Support enum types? "RTCStatsMember<RTCIceCandidateType>"? |
|
Taylor Brandstetter
2016/10/06 19:09:07
That seems like a good idea, since it's an enum in
hbos
2016/10/07 08:37:52
Agreed. It's on my TODO-list but it turned out not
|
| + RTCStatsMember<std::string> candidate_type; |
| + RTCStatsMember<int32_t> priority; |
| + RTCStatsMember<std::string> url; |
| + |
| + protected: |
| + RTCIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| + RTCIceCandidateStats(std::string&& id, int64_t timestamp_us); |
| +}; |
| + |
| +// In the spec both local and remote varieties are of type RTCIceCandidateStats. |
| +// But here we define them as subclasses of |RTCIceCandidateStats| because the |
| +// |kType| need to be different ("RTCStatsType type") in the local/remote case. |
| +// https://w3c.github.io/webrtc-stats/#rtcstatstype-str* |
| +class RTCLocalIceCandidateStats final : public RTCIceCandidateStats { |
|
Taylor Brandstetter
2016/10/06 19:09:07
Is this just to avoid storing the "type" string mu
hbos
2016/10/07 08:37:52
Good point. The static variable used as a class id
|
| + public: |
| + static const char kType[]; |
| + RTCLocalIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| + RTCLocalIceCandidateStats(std::string&& id, int64_t timestamp_us); |
| + const char* type() const override; |
| +}; |
| + |
| +class RTCRemoteIceCandidateStats final : public RTCIceCandidateStats { |
| + public: |
| + static const char kType[]; |
| + RTCRemoteIceCandidateStats(const std::string& id, int64_t timestamp_us); |
| + RTCRemoteIceCandidateStats(std::string&& id, int64_t timestamp_us); |
| + const char* type() const override; |
| +}; |
| + |
| // https://w3c.github.io/webrtc-stats/#certificatestats-dict* |
| -class RTCCertificateStats : public RTCStats { |
| +class RTCCertificateStats final : public RTCStats { |
| public: |
| WEBRTC_RTCSTATS_DECL(); |
| @@ -35,7 +84,7 @@ class RTCCertificateStats : public RTCStats { |
| // https://w3c.github.io/webrtc-stats/#pcstats-dict* |
| // TODO(hbos): Tracking bug crbug.com/636818 |
| -class RTCPeerConnectionStats : public RTCStats { |
| +class RTCPeerConnectionStats final : public RTCStats { |
| public: |
| WEBRTC_RTCSTATS_DECL(); |