From d37bcfa8820507e7f93052a4cac62acdd80978e9 Mon Sep 17 00:00:00 2001 From: "mallinath@webrtc.org" Date: Mon, 12 May 2014 23:10:18 +0000 Subject: [PATCH] Changed enums to less generic names. IPv4/IPv6 will be sent when RegisterUMAObserver is called. This is done as Initialize is not called through interface. R=jiayl@webrtc.org Review URL: https://webrtc-codereview.appspot.com/14469006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6112 4adac7df-926f-26a2-2b94-8c16560cd09d --- talk/app/webrtc/peerconnection.cc | 8 ++++++++ talk/app/webrtc/peerconnectioninterface.h | 5 +++-- talk/app/webrtc/umametrics.h | 8 ++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/talk/app/webrtc/peerconnection.cc b/talk/app/webrtc/peerconnection.cc index 2cb29462f..7774aa27c 100644 --- a/talk/app/webrtc/peerconnection.cc +++ b/talk/app/webrtc/peerconnection.cc @@ -622,6 +622,14 @@ bool PeerConnection::AddIceCandidate( void PeerConnection::RegisterUMAObserver(UMAObserver* observer) { uma_observer_ = observer; + // Send information about IPv4/IPv6 status. + if (uma_observer_ && port_allocator_) { + if (port_allocator_->flags() & cricket::PORTALLOCATOR_ENABLE_IPV6) { + uma_observer_->IncrementCounter(kPeerConnection_IPv4); + } else { + uma_observer_->IncrementCounter(kPeerConnection_IPv6); + } + } } const SessionDescriptionInterface* PeerConnection::local_description() const { diff --git a/talk/app/webrtc/peerconnectioninterface.h b/talk/app/webrtc/peerconnectioninterface.h index 54d341753..ed4033c17 100644 --- a/talk/app/webrtc/peerconnectioninterface.h +++ b/talk/app/webrtc/peerconnectioninterface.h @@ -121,8 +121,9 @@ class StatsObserver : public talk_base::RefCountInterface { class UMAObserver : public talk_base::RefCountInterface { public: - virtual void IncrementCounter(UMAMetricsCounter type) = 0; - virtual void AddHistogramSample(UMAMetricsName type, int value) = 0; + virtual void IncrementCounter(PeerConnectionUMAMetricsCounter type) = 0; + virtual void AddHistogramSample(PeerConnectionUMAMetricsName type, + int value) = 0; protected: virtual ~UMAObserver() {} diff --git a/talk/app/webrtc/umametrics.h b/talk/app/webrtc/umametrics.h index e6414c3c1..81f7bac40 100755 --- a/talk/app/webrtc/umametrics.h +++ b/talk/app/webrtc/umametrics.h @@ -39,7 +39,7 @@ namespace webrtc { // chromium/src/tools/metrics/histograms/histograms.xml // Existing values cannot be re-ordered and new enums must be added // before kBoundary. -enum UMAMetricsCounter { +enum PeerConnectionUMAMetricsCounter { kPeerConnection_IPv4, kPeerConnection_IPv6, kBestConnections_IPv4, @@ -48,9 +48,9 @@ enum UMAMetricsCounter { }; // This enum defines types for UMA samples, which will have a range. -enum UMAMetricsName { - kNetworkInterfaces_IPv4, - kNetworkInterfaces_IPv6, +enum PeerConnectionUMAMetricsName { + kNetworkInterfaces_IPv4, // Number of IPv4 interfaces. + kNetworkInterfaces_IPv6, // Number of IPv6 interfaces. kTimeToConnect, // In milliseconds. };