Index: content/renderer/media/media_stream_dependency_factory.cc |
diff --git a/content/renderer/media/media_stream_dependency_factory.cc b/content/renderer/media/media_stream_dependency_factory.cc |
index 7d4a52d68b903e6b4e3d9724bb5eeaafa3824eef..64f7f113673b188a33d165e93d9bb527ce72e154 100644 |
--- a/content/renderer/media/media_stream_dependency_factory.cc |
+++ b/content/renderer/media/media_stream_dependency_factory.cc |
@@ -6,6 +6,8 @@ |
#include <vector> |
+#include "base/metrics/histogram.h" |
+#include "content/renderer/media/peer_connection_handler_jsep.h" |
#include "content/renderer/media/video_capture_impl_manager.h" |
#include "content/renderer/media/video_capture_module_impl.h" |
#include "content/renderer/media/webrtc_audio_device_impl.h" |
@@ -15,6 +17,26 @@ |
#include "jingle/glue/thread_wrapper.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
+namespace { |
darin (slow to review)
2012/09/06 18:24:59
nit: add new line below here.
perkj_chrome
2012/09/12 11:53:15
Moved to webrtc_uma_histograms.
|
+// Helper enum used for histogramming calls to WebRTC APIs from JavaScript. |
+// TODO(perkj): This is a duplicate of the code in media_stream_impl. |
+// The enum and UpdateWebRTCMethodCount must bee kept in sync with |
darin (slow to review)
2012/09/06 18:24:59
bee -> be
perkj_chrome
2012/09/12 13:54:38
Done.
|
+// media_stream_impl. Find a better way of doing this. |
piman
2012/09/06 17:04:45
Can we just move it to a common header?
perkj_chrome
2012/09/12 11:53:15
Done.
|
+enum JavaScriptAPIName { |
+ kWebkitGetUserMedia, |
darin (slow to review)
2012/09/06 18:24:59
nit: chromium follows the old google c++ style rul
perkj_chrome
2012/09/12 13:54:38
Done.
|
+ kWebkitPeerConnection, |
+ kInvalidName |
+}; |
+ |
+// 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) { |
darin (slow to review)
2012/09/06 18:24:59
nit: "static" keyword inside anonymous namespace i
perkj_chrome
2012/09/12 11:53:15
Done.
|
+ UMA_HISTOGRAM_ENUMERATION("WebRTC.webkitApiCount", api_name, kInvalidName); |
+} |
+ |
+} // namespace |
+ |
class P2PPortAllocatorFactory : public webrtc::PortAllocatorFactoryInterface { |
public: |
P2PPortAllocatorFactory( |
@@ -73,6 +95,21 @@ MediaStreamDependencyFactory::MediaStreamDependencyFactory( |
MediaStreamDependencyFactory::~MediaStreamDependencyFactory() {} |
+WebKit::WebPeerConnection00Handler* |
+MediaStreamDependencyFactory::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 |
+ // webKitPeerConnection00. |
+ UpdateWebRTCMethodCount(kWebkitPeerConnection); |
+ |
+ PeerConnectionHandlerJsep* pc_handler = new PeerConnectionHandlerJsep( |
+ client, |
+ this); |
+ return pc_handler; |
piman
2012/09/06 17:04:45
style nit: if you just return new PeerConnectionHa
perkj_chrome
2012/09/12 13:54:38
Done.
|
+} |
+ |
bool MediaStreamDependencyFactory::CreatePeerConnectionFactory( |
talk_base::Thread* worker_thread, |
talk_base::Thread* signaling_thread, |