summaryrefslogtreecommitdiffstats
path: root/content/renderer/media
diff options
context:
space:
mode:
authorhenrika@chromium.org <henrika@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-02 09:13:59 +0000
committerhenrika@chromium.org <henrika@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-02 09:13:59 +0000
commita21805b2b6967e966df7eb4c083bb421f529eb9e (patch)
treede6f9b289ac9d5176fe088e5ff6291e77f097165 /content/renderer/media
parent4f5c4b89293b9cd686468e7e921df16aa80d891b (diff)
downloadchromium_src-a21805b2b6967e966df7eb4c083bb421f529eb9e.zip
chromium_src-a21805b2b6967e966df7eb4c083bb421f529eb9e.tar.gz
chromium_src-a21805b2b6967e966df7eb4c083bb421f529eb9e.tar.bz2
Adds WebRTC.webkitApiCount histogram to MediaStreamImpl.
BUG=125327 TEST=Tested using chrome://histograms/WebRTC and JS test pages. Review URL: http://codereview.chromium.org/10268005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134882 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/media')
-rw-r--r--content/renderer/media/media_stream_impl.cc27
1 files changed, 18 insertions, 9 deletions
diff --git a/content/renderer/media/media_stream_impl.cc b/content/renderer/media/media_stream_impl.cc
index f8c98a4..f407e78 100644
--- a/content/renderer/media/media_stream_impl.cc
+++ b/content/renderer/media/media_stream_impl.cc
@@ -36,13 +36,22 @@ const int kVideoCaptureWidth = 640;
const int kVideoCaptureHeight = 480;
const int kVideoCaptureFramePerSecond = 30;
-// Histogram names. Histograms can be viewed at chrome://histograms/WebRTC
-const char kHistogramGetUserMedia[] = "WebRTC.webkitGetUserMediaCount";
-const char kHistogramPeerConnection[] = "WebRTC.webkitPeerConnection00Count";
-const char kHistogramDeprecatedPeerConnection[] =
- "WebRTC.webkitDeprecatedPeerConnectionCount";
+// Helper enum used for histogramming calls to WebRTC APIs from JavaScript.
+enum JavaScriptAPIName {
+ kWebkitGetUserMedia,
+ kWebkitPeerConnection,
+ kWebkitDeprecatedPeerConnection,
+ kInvalidName
+};
} // namespace
+// Helper method used to collect information about the number of times
+// different WebRTC API:s are called from JavaScript.
+// The histogram can be viewed at chrome://histograms/WebRTC.webkitApiCount.
+static void UpdateWebRTCMethodCount(JavaScriptAPIName api_name) {
+ UMA_HISTOGRAM_ENUMERATION("WebRTC.webkitApiCount", api_name, kInvalidName);
+}
+
// The MediaStreamMananger label for a stream is globally unique. The track
// session id is globally unique for the set of audio tracks and video tracks
// respectively. An audio track and a video track can have the same session id
@@ -120,7 +129,7 @@ WebKit::WebPeerConnectionHandler* MediaStreamImpl::CreatePeerConnectionHandler(
// Save histogram data so we can see how much PeerConnetion is used.
// The histogram counts the number of calls to the JS API
// webKitDeprecatedPeerConnection.
- UMA_HISTOGRAM_COUNTS_100(kHistogramDeprecatedPeerConnection, 1);
+ UpdateWebRTCMethodCount(kWebkitDeprecatedPeerConnection);
DCHECK(CalledOnValidThread());
if (!EnsurePeerConnectionFactory())
return NULL;
@@ -139,8 +148,8 @@ MediaStreamImpl::CreatePeerConnectionHandlerJsep(
WebKit::WebPeerConnection00HandlerClient* client) {
// Save histogram data so we can see how much PeerConnetion is used.
// The histogram counts the number of calls to the JS API
- // webKitPeerConnection.
- UMA_HISTOGRAM_COUNTS_100(kHistogramPeerConnection, 1);
+ // webKitPeerConnection00.
+ UpdateWebRTCMethodCount(kWebkitPeerConnection);
DCHECK(CalledOnValidThread());
if (!EnsurePeerConnectionFactory())
return NULL;
@@ -177,7 +186,7 @@ void MediaStreamImpl::requestUserMedia(
// Save histogram data so we can see how much GetUserMedia is used.
// The histogram counts the number of calls to the JS API
// webGetUserMedia.
- UMA_HISTOGRAM_COUNTS_100(kHistogramGetUserMedia, 1);
+ UpdateWebRTCMethodCount(kWebkitGetUserMedia);
DCHECK(CalledOnValidThread());
DCHECK(!user_media_request.isNull());
int request_id = g_next_request_id++;