diff options
author | hta@chromium.org <hta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-11 14:45:08 +0000 |
---|---|---|
committer | hta@chromium.org <hta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-11 14:45:08 +0000 |
commit | 0df90c4ad84c4996f9438cbd1063beb5cfaca516 (patch) | |
tree | 449e3c1758a4048fcbaf7c55d1505d34ea6126e9 /content/renderer/media/rtc_peer_connection_handler.h | |
parent | ab4e38c7faa56afa32db1fe108d63bf0802ba95b (diff) | |
download | chromium_src-0df90c4ad84c4996f9438cbd1063beb5cfaca516.zip chromium_src-0df90c4ad84c4996f9438cbd1063beb5cfaca516.tar.gz chromium_src-0df90c4ad84c4996f9438cbd1063beb5cfaca516.tar.bz2 |
Implement stats passing between libjingle and Webkit.
This allows the getStats call in webkit to be relayed to the getStats call
in libjingle.
BUG=
Review URL: https://chromiumcodereview.appspot.com/11308167
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172325 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/media/rtc_peer_connection_handler.h')
-rw-r--r-- | content/renderer/media/rtc_peer_connection_handler.h | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/content/renderer/media/rtc_peer_connection_handler.h b/content/renderer/media/rtc_peer_connection_handler.h index 01db449..dd9fee1 100644 --- a/content/renderer/media/rtc_peer_connection_handler.h +++ b/content/renderer/media/rtc_peer_connection_handler.h @@ -10,6 +10,8 @@ #include "content/common/content_export.h" #include "content/renderer/media/peer_connection_handler_base.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebRTCPeerConnectionHandler.h" +#include "third_party/WebKit/Source/Platform/chromium/public/WebRTCStatsRequest.h" +#include "third_party/WebKit/Source/Platform/chromium/public/WebRTCStatsResponse.h" namespace WebKit { class WebFrame; @@ -17,10 +19,55 @@ class WebFrame; namespace content { +// Mockable wrapper for WebKit::WebRTCStatsResponse +class CONTENT_EXPORT LocalRTCStatsResponse + : public talk_base::RefCountInterface { + public: + explicit LocalRTCStatsResponse(const WebKit::WebRTCStatsResponse& impl) + : impl_(impl) { + } + // Constructor for testing. + LocalRTCStatsResponse() {} + + virtual WebKit::WebRTCStatsResponse webKitStatsResponse() const; + virtual size_t addReport(); + virtual void addElement(size_t report, bool is_local, double timestamp); + virtual void addStatistic(size_t report, bool is_local, + WebKit::WebString name, WebKit::WebString value); + + protected: + virtual ~LocalRTCStatsResponse() {} + + private: + WebKit::WebRTCStatsResponse impl_; +}; + +// Mockable wrapper for WebKit::WebRTCStatsRequest +class CONTENT_EXPORT LocalRTCStatsRequest + : public talk_base::RefCountInterface { + public: + explicit LocalRTCStatsRequest(WebKit::WebRTCStatsRequest impl); + // Constructor for testing. + LocalRTCStatsRequest(); + + virtual bool hasSelector() const; + virtual WebKit::WebMediaStreamDescriptor stream() const; + virtual WebKit::WebMediaStreamComponent component() const; + virtual void requestSucceeded(const LocalRTCStatsResponse* response); + virtual scoped_refptr<LocalRTCStatsResponse> createResponse(); + + protected: + virtual ~LocalRTCStatsRequest(); + + private: + WebKit::WebRTCStatsRequest impl_; + talk_base::scoped_refptr<LocalRTCStatsResponse> response_; +}; + // RTCPeerConnectionHandler is a delegate for the RTC PeerConnection API // messages going between WebKit and native PeerConnection in libjingle. It's // owned by WebKit. -// WebKit call all of these methods on the main render thread. +// WebKit calls all of these methods on the main render thread. // Callbacks to the webrtc::PeerConnectionObserver implementation also occur on // the main render thread. class CONTENT_EXPORT RTCPeerConnectionHandler @@ -73,6 +120,8 @@ class CONTENT_EXPORT RTCPeerConnectionHandler const WebKit::WebMediaConstraints& options) OVERRIDE; virtual void removeStream( const WebKit::WebMediaStreamDescriptor& stream) OVERRIDE; + virtual void getStats( + const WebKit::WebRTCStatsRequest& request) OVERRIDE; // We will be deleted by WebKit after stop has been returned. virtual void stop() OVERRIDE; @@ -86,6 +135,10 @@ class CONTENT_EXPORT RTCPeerConnectionHandler virtual void OnIceComplete() OVERRIDE; virtual void OnRenegotiationNeeded() OVERRIDE; + // Delegate functions to allow for mocking of WebKit interfaces. + // getStats takes ownership of request parameter. + virtual void getStats(LocalRTCStatsRequest* request); + private: webrtc::SessionDescriptionInterface* CreateNativeSessionDescription( const WebKit::WebRTCSessionDescription& description); |