OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_uma_histograms.h" | 5 #include "content/renderer/media/webrtc_uma_histograms.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 | 10 |
11 void LogUserMediaRequestWithNoResult(bool request_cancelled, | |
12 bool stream_generated, | |
13 bool pending_sources) { | |
14 enum { | |
Mark P
2014/08/05 18:50:23
Please explicitly state that elements in this enum
vrk (LEFT CHROMIUM)
2014/08/05 19:05:41
Move this enum to content/public/common/media_stre
andresp-chromium
2014/08/06 10:13:56
Done.
andresp-chromium
2014/08/06 10:13:56
Done. But moved the enum into webrtc_uma_histogram
| |
15 USER_MEDIA_REQUEST_CANCELLED, | |
Mark P
2014/08/05 18:50:23
Please explicitly use = 0, = 1, etc.
andresp-chromium
2014/08/06 10:13:56
Done.
| |
16 USER_MEDIA_REQUEST_NOT_GENERATED, | |
17 USER_MEDIA_REQUEST_PENDING_MEDIA_TRACKS, | |
18 NUM_USER_MEDIA_REQUEST_WITH_NO_RESULT | |
19 }; | |
20 | |
21 // If a stream has been generated then there must be pending sources otherwise | |
22 // there would have been a result. Additionally there can't be pending sources | |
23 // before it gets generated. | |
24 DCHECK(stream_generated ? pending_sources : !pending_sources); | |
vrk (LEFT CHROMIUM)
2014/08/05 19:05:41
FYI, could have done DCHECK_EQ(stream_generated, p
andresp-chromium
2014/08/06 10:13:56
Acknowledged.
| |
25 | |
26 UMA_HISTOGRAM_ENUMERATION( | |
27 "WebRTC.UserMediaRequest.NoResultState", | |
28 request_cancelled | |
29 ? USER_MEDIA_REQUEST_CANCELLED | |
30 : (!stream_generated ? USER_MEDIA_REQUEST_NOT_GENERATED | |
31 : USER_MEDIA_REQUEST_PENDING_MEDIA_TRACKS), | |
32 NUM_USER_MEDIA_REQUEST_WITH_NO_RESULT); | |
33 } | |
34 | |
11 void LogUserMediaRequestResult(MediaStreamRequestResult result) { | 35 void LogUserMediaRequestResult(MediaStreamRequestResult result) { |
12 UMA_HISTOGRAM_ENUMERATION( | 36 UMA_HISTOGRAM_ENUMERATION( |
13 "WebRTC.UserMediaRequest.Result", result, NUM_MEDIA_REQUEST_RESULTS); | 37 "WebRTC.UserMediaRequest.Result", result, NUM_MEDIA_REQUEST_RESULTS); |
14 } | 38 } |
15 | 39 |
16 void UpdateWebRTCMethodCount(JavaScriptAPIName api_name) { | 40 void UpdateWebRTCMethodCount(JavaScriptAPIName api_name) { |
17 DVLOG(3) << "Incrementing WebRTC.webkitApiCount for " << api_name; | 41 DVLOG(3) << "Incrementing WebRTC.webkitApiCount for " << api_name; |
18 UMA_HISTOGRAM_ENUMERATION("WebRTC.webkitApiCount", api_name, INVALID_NAME); | 42 UMA_HISTOGRAM_ENUMERATION("WebRTC.webkitApiCount", api_name, INVALID_NAME); |
19 PerSessionWebRTCAPIMetrics::GetInstance()->LogUsageOnlyOnce(api_name); | 43 PerSessionWebRTCAPIMetrics::GetInstance()->LogUsageOnlyOnce(api_name); |
20 } | 44 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 LogUsage(api_name); | 80 LogUsage(api_name); |
57 } | 81 } |
58 } | 82 } |
59 | 83 |
60 void PerSessionWebRTCAPIMetrics::ResetUsage() { | 84 void PerSessionWebRTCAPIMetrics::ResetUsage() { |
61 for (size_t i = 0; i < arraysize(has_used_api_); ++i) | 85 for (size_t i = 0; i < arraysize(has_used_api_); ++i) |
62 has_used_api_[i] = false; | 86 has_used_api_[i] = false; |
63 } | 87 } |
64 | 88 |
65 } // namespace content | 89 } // namespace content |
OLD | NEW |