| 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 #include "content/renderer/media/webrtc/rtc_stats.h" | 5 #include "content/renderer/media/webrtc/rtc_stats.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "third_party/webrtc/api/stats/rtcstats_objects.h" | 13 #include "third_party/webrtc/api/stats/rtcstats_objects.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 class RTCStatsWhitelist { | 19 class RTCStatsWhitelist { |
| 20 public: | 20 public: |
| 21 RTCStatsWhitelist() { | 21 RTCStatsWhitelist() { |
| 22 whitelisted_stats_types_.insert(webrtc::RTCCertificateStats::kType); | 22 whitelisted_stats_types_.insert(webrtc::RTCCertificateStats::kType); |
| 23 whitelisted_stats_types_.insert(webrtc::RTCCodecStats::kType); |
| 23 whitelisted_stats_types_.insert(webrtc::RTCDataChannelStats::kType); | 24 whitelisted_stats_types_.insert(webrtc::RTCDataChannelStats::kType); |
| 24 whitelisted_stats_types_.insert(webrtc::RTCIceCandidatePairStats::kType); | 25 whitelisted_stats_types_.insert(webrtc::RTCIceCandidatePairStats::kType); |
| 25 whitelisted_stats_types_.insert(webrtc::RTCIceCandidateStats::kType); | 26 whitelisted_stats_types_.insert(webrtc::RTCIceCandidateStats::kType); |
| 26 whitelisted_stats_types_.insert(webrtc::RTCLocalIceCandidateStats::kType); | 27 whitelisted_stats_types_.insert(webrtc::RTCLocalIceCandidateStats::kType); |
| 27 whitelisted_stats_types_.insert(webrtc::RTCRemoteIceCandidateStats::kType); | 28 whitelisted_stats_types_.insert(webrtc::RTCRemoteIceCandidateStats::kType); |
| 29 whitelisted_stats_types_.insert(webrtc::RTCMediaStreamStats::kType); |
| 30 whitelisted_stats_types_.insert(webrtc::RTCMediaStreamTrackStats::kType); |
| 28 whitelisted_stats_types_.insert(webrtc::RTCPeerConnectionStats::kType); | 31 whitelisted_stats_types_.insert(webrtc::RTCPeerConnectionStats::kType); |
| 29 whitelisted_stats_types_.insert(webrtc::RTCRTPStreamStats::kType); | 32 whitelisted_stats_types_.insert(webrtc::RTCRTPStreamStats::kType); |
| 30 whitelisted_stats_types_.insert(webrtc::RTCInboundRTPStreamStats::kType); | 33 whitelisted_stats_types_.insert(webrtc::RTCInboundRTPStreamStats::kType); |
| 31 whitelisted_stats_types_.insert(webrtc::RTCOutboundRTPStreamStats::kType); | 34 whitelisted_stats_types_.insert(webrtc::RTCOutboundRTPStreamStats::kType); |
| 32 whitelisted_stats_types_.insert(webrtc::RTCTransportStats::kType); | 35 whitelisted_stats_types_.insert(webrtc::RTCTransportStats::kType); |
| 33 } | 36 } |
| 34 | 37 |
| 35 bool IsWhitelisted(const webrtc::RTCStats& stats) { | 38 bool IsWhitelisted(const webrtc::RTCStats& stats) { |
| 36 return whitelisted_stats_types_.find(stats.type()) != | 39 return whitelisted_stats_types_.find(stats.type()) != |
| 37 whitelisted_stats_types_.end(); | 40 whitelisted_stats_types_.end(); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 for (size_t i = 0; i < sequence.size(); ++i) | 273 for (size_t i = 0; i < sequence.size(); ++i) |
| 271 web_sequence[i] = blink::WebString::fromUTF8(sequence[i]); | 274 web_sequence[i] = blink::WebString::fromUTF8(sequence[i]); |
| 272 return web_sequence; | 275 return web_sequence; |
| 273 } | 276 } |
| 274 | 277 |
| 275 void WhitelistStatsForTesting(const char* type) { | 278 void WhitelistStatsForTesting(const char* type) { |
| 276 g_whitelisted_stats.Get().WhitelistStatsForTesting(type); | 279 g_whitelisted_stats.Get().WhitelistStatsForTesting(type); |
| 277 } | 280 } |
| 278 | 281 |
| 279 } // namespace content | 282 } // namespace content |
| OLD | NEW |