OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_UMA_HISTOGRAMS_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_UMA_HISTOGRAMS_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_UMA_HISTOGRAMS_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_UMA_HISTOGRAMS_H_ |
7 | 7 |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "base/threading/non_thread_safe.h" | 9 #include "base/threading/non_thread_safe.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 virtual ~PerSessionWebRTCAPIMetrics(); | 66 virtual ~PerSessionWebRTCAPIMetrics(); |
67 | 67 |
68 static PerSessionWebRTCAPIMetrics* GetInstance(); | 68 static PerSessionWebRTCAPIMetrics* GetInstance(); |
69 | 69 |
70 // Increment/decrement the number of streams being sent or received | 70 // Increment/decrement the number of streams being sent or received |
71 // over any current PeerConnection. | 71 // over any current PeerConnection. |
72 void IncrementStreamCounter(); | 72 void IncrementStreamCounter(); |
73 void DecrementStreamCounter(); | 73 void DecrementStreamCounter(); |
74 | 74 |
75 protected: | 75 protected: |
76 friend struct DefaultSingletonTraits<PerSessionWebRTCAPIMetrics>; | 76 friend struct base::DefaultSingletonTraits<PerSessionWebRTCAPIMetrics>; |
77 friend void UpdateWebRTCMethodCount(JavaScriptAPIName); | 77 friend void UpdateWebRTCMethodCount(JavaScriptAPIName); |
78 | 78 |
79 // Protected so that unit tests can test without this being a | 79 // Protected so that unit tests can test without this being a |
80 // singleton. | 80 // singleton. |
81 PerSessionWebRTCAPIMetrics(); | 81 PerSessionWebRTCAPIMetrics(); |
82 | 82 |
83 // Overridable by unit tests. | 83 // Overridable by unit tests. |
84 virtual void LogUsage(JavaScriptAPIName api_name); | 84 virtual void LogUsage(JavaScriptAPIName api_name); |
85 | 85 |
86 // Called by UpdateWebRTCMethodCount above. Protected rather than | 86 // Called by UpdateWebRTCMethodCount above. Protected rather than |
87 // private so that unit tests can call it. | 87 // private so that unit tests can call it. |
88 void LogUsageOnlyOnce(JavaScriptAPIName api_name); | 88 void LogUsageOnlyOnce(JavaScriptAPIName api_name); |
89 | 89 |
90 private: | 90 private: |
91 void ResetUsage(); | 91 void ResetUsage(); |
92 | 92 |
93 int num_streams_; | 93 int num_streams_; |
94 bool has_used_api_[INVALID_NAME]; | 94 bool has_used_api_[INVALID_NAME]; |
95 | 95 |
96 DISALLOW_COPY_AND_ASSIGN(PerSessionWebRTCAPIMetrics); | 96 DISALLOW_COPY_AND_ASSIGN(PerSessionWebRTCAPIMetrics); |
97 }; | 97 }; |
98 | 98 |
99 } // namespace content | 99 } // namespace content |
100 | 100 |
101 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_UMA_HISTOGRAMS_H_ | 101 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_UMA_HISTOGRAMS_H_ |
OLD | NEW |