Implement the GetStats interface on PeerConnection
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2012 16:16:43 +0000 (16:16 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Sep 2012 16:16:43 +0000 (16:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=95193

Source/Platform:

Patch by Harald Tveit Alvestrand <harald@alvestrand.no> on 2012-09-26
Reviewed by Adam Barth.

* chromium/public/WebRTCPeerConnectionHandler.h:
(WebKit):
(WebRTCPeerConnectionHandler):
(WebKit::WebRTCPeerConnectionHandler::getStats):
* chromium/public/WebRTCStatsRequest.h: added.
(WebCore):
(WebKit):
(WebRTCStatsRequest):
(WebKit::WebRTCStatsRequest::WebRTCStatsRequest):
(WebKit::WebRTCStatsRequest::~WebRTCStatsRequest):
(WebKit::WebRTCStatsRequest::operator=):

Source/WebCore:

Specification:
http://dev.w3.org/2011/webrtc/editor/webrtc-20120920.html

Patch by Harald Tveit Alvestrand <harald@alvestrand.no> on 2012-09-26
Reviewed by Adam Barth.

The implementation consists of a pure virtual platform object
(RTCStatsRequest) that is implemented in WebCore, and stores
its information in a straightforward data hierarchy.
This patch adds the call path and the storage structures.
It does not add filling in data.

Test: fast/mediastream/RTCPeerConnection-stats.html

* CMakeLists.txt:
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::getStats):
(WebCore):
* Modules/mediastream/RTCPeerConnection.h:
(WebCore):
(RTCPeerConnection):
* Modules/mediastream/RTCPeerConnection.idl:
* Modules/mediastream/RTCStatsCallback.h: Added.
(WebCore):
(RTCStatsCallback):
(WebCore::RTCStatsCallback::~RTCStatsCallback):
* Modules/mediastream/RTCStatsCallback.idl: Added.
* Modules/mediastream/RTCStatsElement.cpp: Added.
(WebCore):
(WebCore::RTCStatsElement::create):
(WebCore::RTCStatsElement::RTCStatsElement):
(WebCore::RTCStatsElement::stat):
* Modules/mediastream/RTCStatsElement.h: Added.
(WebCore):
(RTCStatsElement):
* Modules/mediastream/RTCStatsElement.idl: Added.
* Modules/mediastream/RTCStatsReport.cpp: Added.
(WebCore):
(WebCore::RTCStatsReport::create):
(WebCore::RTCStatsReport::RTCStatsReport):
* Modules/mediastream/RTCStatsReport.h: Added.
(WebCore):
(RTCStatsReport):
(WebCore::RTCStatsReport::local):
(WebCore::RTCStatsReport::remote):
* Modules/mediastream/RTCStatsReport.idl: Added.
* Modules/mediastream/RTCStatsRequestImpl.cpp: Added.
(WebCore):
(WebCore::RTCStatsRequestImpl::create):
(WebCore::RTCStatsRequestImpl::RTCStatsRequestImpl):
(WebCore::RTCStatsRequestImpl::~RTCStatsRequestImpl):
(WebCore::RTCStatsRequestImpl::requestSucceeded):
(WebCore::RTCStatsRequestImpl::stop):
(WebCore::RTCStatsRequestImpl::clear):
* Modules/mediastream/RTCStatsRequestImpl.h: Added.
(WebCore):
(RTCStatsRequestImpl):
* Modules/mediastream/RTCStatsResponse.cpp: Added.
(WebCore):
(WebCore::RTCStatsResponse::create):
(WebCore::RTCStatsResponse::RTCStatsResponse):
* Modules/mediastream/RTCStatsResponse.h: Added.
(WebCore):
(RTCStatsResponse):
(WebCore::RTCStatsResponse::result):
* Modules/mediastream/RTCStatsResponse.idl: Added.
* WebCore.gypi:
* platform/chromium/support/WebRTCStatsRequest.cpp: Copied from Source/Platform/chromium/public/WebRTCPeerConnectionHandler.h.
(WebKit):
(WebKit::WebRTCStatsRequest::WebRTCStatsRequest):
(WebKit::WebRTCStatsRequest::assign):
(WebKit::WebRTCStatsRequest::reset):
(WebKit::WebRTCStatsRequest::requestSucceeded):
* platform/mediastream/RTCPeerConnectionHandler.h:
(WebCore):
(RTCPeerConnectionHandler):
* platform/mediastream/RTCStatsRequest.h: Copied from Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.h.
(WebCore):
(RTCStatsRequest):
(WebCore::RTCStatsRequest::~RTCStatsRequest):
(WebCore::RTCStatsRequest::RTCStatsRequest):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp:
(WebCore::RTCPeerConnectionHandlerChromium::getStats):
(WebCore):
* platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h:
(RTCPeerConnectionHandlerChromium):

Tools:

Patch by Harald Tveit Alvestrand <harald@alvestrand.no> on 2012-09-26
Reviewed by Adam Barth.

* DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp:
(RTCStatsRequestSucceededTask):
(RTCStatsRequestSucceededTask::RTCStatsRequestSucceededTask):
(MockWebRTCPeerConnectionHandler::getStats):
* DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h:
(MockWebRTCPeerConnectionHandler):

LayoutTests:

Patch by Harald Tveit Alvestrand <harald@alvestrand.no> on 2012-09-26
Reviewed by Adam Barth.

* fast/mediastream/RTCPeerConnection-stats-expected.txt: Added.
* fast/mediastream/RTCPeerConnection-stats.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129654 268f45cc-cd09-0410-ab3c-d52691b4dbfc

35 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/mediastream/RTCPeerConnection-stats-expected.txt [new file with mode: 0644]
LayoutTests/fast/mediastream/RTCPeerConnection-stats.html [new file with mode: 0644]
Source/Platform/ChangeLog
Source/Platform/chromium/public/WebRTCPeerConnectionHandler.h
Source/Platform/chromium/public/WebRTCStatsRequest.h [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
Source/WebCore/Modules/mediastream/RTCPeerConnection.h
Source/WebCore/Modules/mediastream/RTCPeerConnection.idl
Source/WebCore/Modules/mediastream/RTCStatsCallback.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCStatsCallback.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCStatsElement.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCStatsElement.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCStatsElement.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCStatsReport.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCStatsReport.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCStatsReport.idl [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCStatsRequestImpl.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCStatsRequestImpl.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCStatsResponse.cpp [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCStatsResponse.h [new file with mode: 0644]
Source/WebCore/Modules/mediastream/RTCStatsResponse.idl [new file with mode: 0644]
Source/WebCore/WebCore.gypi
Source/WebCore/platform/chromium/support/WebRTCStatsRequest.cpp [new file with mode: 0644]
Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.cpp
Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.h
Source/WebCore/platform/mediastream/RTCStatsRequest.h [new file with mode: 0644]
Source/WebCore/platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp
Source/WebCore/platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h
Tools/ChangeLog
Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp
Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h

index c7f8168..3e8e9ef 100644 (file)
@@ -1,3 +1,13 @@
+2012-09-26  Harald Tveit Alvestrand  <harald@alvestrand.no>
+        
+        Implement the GetStats interface on PeerConnection
+        https://bugs.webkit.org/show_bug.cgi?id=95193
+
+        Reviewed by Adam Barth.
+
+        * fast/mediastream/RTCPeerConnection-stats-expected.txt: Added.
+        * fast/mediastream/RTCPeerConnection-stats.html: Added.
+
 2012-09-26  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
 
         [WK2][WTR] Policy client: dumping from decidePolicyForResponse callback
diff --git a/LayoutTests/fast/mediastream/RTCPeerConnection-stats-expected.txt b/LayoutTests/fast/mediastream/RTCPeerConnection-stats-expected.txt
new file mode 100644 (file)
index 0000000..ffe336e
--- /dev/null
@@ -0,0 +1,14 @@
+Tests the RTCPeerConnection stats interface.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS pc = new webkitRTCPeerConnection(null) did not throw exception.
+PASS pc.getStats(statsHandler) did not throw exception.
+PASS statsHandler was called
+PASS status is non-null.
+PASS result.length is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/mediastream/RTCPeerConnection-stats.html b/LayoutTests/fast/mediastream/RTCPeerConnection-stats.html
new file mode 100644 (file)
index 0000000..9675ca3
--- /dev/null
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+description("Tests the RTCPeerConnection stats interface.");
+
+var pc = null;
+
+function statsHandler(status)
+{
+    testPassed("statsHandler was called");
+    shouldBeNonNull('status');
+    result = status.result();
+    shouldBe('result.length', '0');
+    finishJSTest();
+}
+
+shouldNotThrow('pc = new webkitRTCPeerConnection(null)');
+shouldNotThrow('pc.getStats(statsHandler)');
+
+window.jsTestIsAsync = true;
+window.successfullyParsed = true;
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
index c02b94f..be8fc2a 100644 (file)
@@ -1,3 +1,22 @@
+2012-09-26  Harald Tveit Alvestrand  <harald@alvestrand.no>
+
+        Implement the GetStats interface on PeerConnection
+        https://bugs.webkit.org/show_bug.cgi?id=95193
+
+        Reviewed by Adam Barth.
+
+        * chromium/public/WebRTCPeerConnectionHandler.h:
+        (WebKit):
+        (WebRTCPeerConnectionHandler):
+        (WebKit::WebRTCPeerConnectionHandler::getStats):
+        * chromium/public/WebRTCStatsRequest.h: added.
+        (WebCore):
+        (WebKit):
+        (WebRTCStatsRequest):
+        (WebKit::WebRTCStatsRequest::WebRTCStatsRequest):
+        (WebKit::WebRTCStatsRequest::~WebRTCStatsRequest):
+        (WebKit::WebRTCStatsRequest::operator=):
+
 2012-09-25  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r129517.
index 823466a..e0c6630 100644 (file)
@@ -39,6 +39,7 @@ class WebRTCICECandidate;
 class WebRTCPeerConnectionHandlerClient;
 class WebRTCSessionDescription;
 class WebRTCSessionDescriptionRequest;
+class WebRTCStatsRequest;
 class WebRTCVoidRequest;
 
 class WebRTCPeerConnectionHandler {
@@ -57,6 +58,8 @@ public:
     virtual bool addICECandidate(const WebRTCICECandidate&) = 0;
     virtual bool addStream(const WebMediaStreamDescriptor&, const WebMediaConstraints&) = 0;
     virtual void removeStream(const WebMediaStreamDescriptor&) = 0;
+    // FIXME: Remove default implementation when clients have changed.
+    virtual void getStats(const WebRTCStatsRequest&) { }
     virtual void stop() = 0;
 };
 
diff --git a/Source/Platform/chromium/public/WebRTCStatsRequest.h b/Source/Platform/chromium/public/WebRTCStatsRequest.h
new file mode 100644 (file)
index 0000000..4d68c11
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebRTCStatsRequest_h
+#define WebRTCStatsRequest_h
+
+#include "WebCommon.h"
+#include "WebPrivatePtr.h"
+#include "WebString.h"
+
+namespace WebCore {
+class RTCStatsRequest;
+}
+
+namespace WebKit {
+
+class WebRTCStatsRequest {
+public:
+    WebRTCStatsRequest() { }
+    WebRTCStatsRequest(const WebRTCStatsRequest& other) { assign(other); }
+    ~WebRTCStatsRequest() { reset(); }
+
+    WebRTCStatsRequest& operator=(const WebRTCStatsRequest& other)
+    {
+        assign(other);
+        return *this;
+    }
+
+    WEBKIT_EXPORT void assign(const WebRTCStatsRequest&);
+
+    WEBKIT_EXPORT void reset();
+
+    WEBKIT_EXPORT void requestSucceeded() const;
+
+#if WEBKIT_IMPLEMENTATION
+    WebRTCStatsRequest(const WTF::PassRefPtr<WebCore::RTCStatsRequest>&);
+#endif
+
+private:
+    WebPrivatePtr<WebCore::RTCStatsRequest> m_private;
+};
+
+} // namespace WebKit
+
+#endif // WebRTCStatsRequest_h
index 5d06bb5..11138ca 100644 (file)
@@ -228,6 +228,10 @@ SET(WebCore_IDL_FILES
     Modules/mediastream/RTCPeerConnection.idl
     Modules/mediastream/RTCSessionDescription.idl
     Modules/mediastream/RTCSessionDescriptionCallback.idl
+    Modules/mediastream/RTCStatsCallback.idl
+    Modules/mediastream/RTCStatsElement.idl
+    Modules/mediastream/RTCStatsReport.idl
+    Modules/mediastream/RTCStatsResponse.idl
     Modules/mediastream/SessionDescription.idl
 
     Modules/navigatorcontentutils/NavigatorContentUtils.idl
@@ -861,6 +865,10 @@ SET(WebCore_SOURCES
     Modules/mediastream/RTCPeerConnection.cpp
     Modules/mediastream/RTCSessionDescription.cpp
     Modules/mediastream/RTCSessionDescriptionRequestImpl.cpp
+    Modules/mediastream/RTCStatsElement.cpp
+    Modules/mediastream/RTCStatsReport.cpp
+    Modules/mediastream/RTCStatsRequestImpl.cpp
+    Modules/mediastream/RTCStatsResponse.cpp
     Modules/mediastream/RTCVoidRequestImpl.cpp
     Modules/mediastream/SessionDescription.cpp
     Modules/mediastream/UserMediaController.cpp
index 3cab5a8..31c2ef3 100644 (file)
@@ -1,3 +1,94 @@
+2012-09-26  Harald Tveit Alvestrand  <harald@alvestrand.no>
+        
+        Implement the GetStats interface on PeerConnection
+        https://bugs.webkit.org/show_bug.cgi?id=95193
+
+        Specification:
+        http://dev.w3.org/2011/webrtc/editor/webrtc-20120920.html
+
+        Reviewed by Adam Barth.
+
+        The implementation consists of a pure virtual platform object
+        (RTCStatsRequest) that is implemented in WebCore, and stores
+        its information in a straightforward data hierarchy.
+        This patch adds the call path and the storage structures.
+        It does not add filling in data.
+
+        Test: fast/mediastream/RTCPeerConnection-stats.html
+
+        * CMakeLists.txt:
+        * Modules/mediastream/RTCPeerConnection.cpp:
+        (WebCore::RTCPeerConnection::getStats):
+        (WebCore):
+        * Modules/mediastream/RTCPeerConnection.h:
+        (WebCore):
+        (RTCPeerConnection):
+        * Modules/mediastream/RTCPeerConnection.idl:
+        * Modules/mediastream/RTCStatsCallback.h: Added.
+        (WebCore):
+        (RTCStatsCallback):
+        (WebCore::RTCStatsCallback::~RTCStatsCallback):
+        * Modules/mediastream/RTCStatsCallback.idl: Added.
+        * Modules/mediastream/RTCStatsElement.cpp: Added.
+        (WebCore):
+        (WebCore::RTCStatsElement::create):
+        (WebCore::RTCStatsElement::RTCStatsElement):
+        (WebCore::RTCStatsElement::stat):
+        * Modules/mediastream/RTCStatsElement.h: Added.
+        (WebCore):
+        (RTCStatsElement):
+        * Modules/mediastream/RTCStatsElement.idl: Added.
+        * Modules/mediastream/RTCStatsReport.cpp: Added.
+        (WebCore):
+        (WebCore::RTCStatsReport::create):
+        (WebCore::RTCStatsReport::RTCStatsReport):
+        * Modules/mediastream/RTCStatsReport.h: Added.
+        (WebCore):
+        (RTCStatsReport):
+        (WebCore::RTCStatsReport::local):
+        (WebCore::RTCStatsReport::remote):
+        * Modules/mediastream/RTCStatsReport.idl: Added.
+        * Modules/mediastream/RTCStatsRequestImpl.cpp: Added.
+        (WebCore):
+        (WebCore::RTCStatsRequestImpl::create):
+        (WebCore::RTCStatsRequestImpl::RTCStatsRequestImpl):
+        (WebCore::RTCStatsRequestImpl::~RTCStatsRequestImpl):
+        (WebCore::RTCStatsRequestImpl::requestSucceeded):
+        (WebCore::RTCStatsRequestImpl::stop):
+        (WebCore::RTCStatsRequestImpl::clear):
+        * Modules/mediastream/RTCStatsRequestImpl.h: Added.
+        (WebCore):
+        (RTCStatsRequestImpl):
+        * Modules/mediastream/RTCStatsResponse.cpp: Added.
+        (WebCore):
+        (WebCore::RTCStatsResponse::create):
+        (WebCore::RTCStatsResponse::RTCStatsResponse):
+        * Modules/mediastream/RTCStatsResponse.h: Added.
+        (WebCore):
+        (RTCStatsResponse):
+        (WebCore::RTCStatsResponse::result):
+        * Modules/mediastream/RTCStatsResponse.idl: Added.
+        * WebCore.gypi:
+        * platform/chromium/support/WebRTCStatsRequest.cpp: Copied from Source/Platform/chromium/public/WebRTCPeerConnectionHandler.h.
+        (WebKit):
+        (WebKit::WebRTCStatsRequest::WebRTCStatsRequest):
+        (WebKit::WebRTCStatsRequest::assign):
+        (WebKit::WebRTCStatsRequest::reset):
+        (WebKit::WebRTCStatsRequest::requestSucceeded):
+        * platform/mediastream/RTCPeerConnectionHandler.h:
+        (WebCore):
+        (RTCPeerConnectionHandler):
+        * platform/mediastream/RTCStatsRequest.h: Copied from Source/WebCore/platform/mediastream/RTCPeerConnectionHandler.h.
+        (WebCore):
+        (RTCStatsRequest):
+        (WebCore::RTCStatsRequest::~RTCStatsRequest):
+        (WebCore::RTCStatsRequest::RTCStatsRequest):
+        * platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.cpp:
+        (WebCore::RTCPeerConnectionHandlerChromium::getStats):
+        (WebCore):
+        * platform/mediastream/chromium/RTCPeerConnectionHandlerChromium.h:
+        (RTCPeerConnectionHandlerChromium):
+
 2012-09-26  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
 
         [WK2][WTR] Policy client: dumping from decidePolicyForResponse callback
index be197c0..e551d27 100644 (file)
@@ -639,6 +639,14 @@ webcore_built_sources += \
        DerivedSources/WebCore/JSRTCSessionDescription.h \
        DerivedSources/WebCore/JSRTCSessionDescriptionCallback.cpp \
        DerivedSources/WebCore/JSRTCSessionDescriptionCallback.h \
+       DerivedSources/WebCore/JSRTCStatsCallback.cpp \
+       DerivedSources/WebCore/JSRTCStatsCallback.h \
+       DerivedSources/WebCore/JSRTCStatsElement.cpp \
+       DerivedSources/WebCore/JSRTCStatsElement.h \
+       DerivedSources/WebCore/JSRTCStatsReport.cpp \
+       DerivedSources/WebCore/JSRTCStatsReport.h \
+       DerivedSources/WebCore/JSRTCStatsResponse.cpp \
+       DerivedSources/WebCore/JSRTCStatsResponse.h \
        DerivedSources/WebCore/JSScreen.cpp \
        DerivedSources/WebCore/JSScreen.h \
        DerivedSources/WebCore/JSScriptProfile.cpp \
@@ -1236,6 +1244,10 @@ dom_binding_idls += \
        $(WebCore)/Modules/mediastream/RTCPeerConnection.idl \
        $(WebCore)/Modules/mediastream/RTCSessionDescription.idl \
        $(WebCore)/Modules/mediastream/RTCSessionDescriptionCallback.idl \
+       $(WebCore)/Modules/mediastream/RTCStatsCallback.idl \
+       $(WebCore)/Modules/mediastream/RTCStatsElement.idl \
+       $(WebCore)/Modules/mediastream/RTCStatsReport.idl \
+       $(WebCore)/Modules/mediastream/RTCStatsResponse.idl \
        $(WebCore)/Modules/mediastream/SessionDescription.idl \
        $(WebCore)/Modules/navigatorcontentutils/NavigatorContentUtils.idl \
        $(WebCore)/Modules/notifications/Notification.idl \
index cb9ba7c..9612539 100644 (file)
@@ -48,6 +48,8 @@
 #include "RTCSessionDescriptionCallback.h"
 #include "RTCSessionDescriptionDescriptor.h"
 #include "RTCSessionDescriptionRequestImpl.h"
+#include "RTCStatsCallback.h"
+#include "RTCStatsRequestImpl.h"
 #include "RTCVoidRequestImpl.h"
 #include "ScriptExecutionContext.h"
 #include "VoidCallback.h"
@@ -379,6 +381,13 @@ MediaStreamList* RTCPeerConnection::remoteStreams() const
     return m_remoteStreams.get();
 }
 
+void RTCPeerConnection::getStats(PassRefPtr<RTCStatsCallback> successCallback, PassRefPtr<MediaStreamTrack> selector)
+{
+    RefPtr<RTCStatsRequestImpl> statsRequest = RTCStatsRequestImpl::create(scriptExecutionContext(), successCallback);
+    // FIXME: Add passing selector as part of the statsRequest.
+    m_peerHandler->getStats(statsRequest.release());
+}
+
 void RTCPeerConnection::close(ExceptionCode& ec)
 {
     if (m_readyState == ReadyStateClosing || m_readyState == ReadyStateClosed) {
index 84d1e1f..a77aef2 100644 (file)
 namespace WebCore {
 
 class MediaConstraints;
+class MediaStreamTrack;
 class RTCConfiguration;
 class RTCErrorCallback;
 class RTCSessionDescription;
 class RTCSessionDescriptionCallback;
+class RTCStatsCallback;
 class VoidCallback;
 
 class RTCPeerConnection : public RefCounted<RTCPeerConnection>, public RTCPeerConnectionHandlerClient, public EventTarget, public ActiveDOMObject {
@@ -84,6 +86,8 @@ public:
 
     void removeStream(MediaStream*, ExceptionCode&);
 
+    void getStats(PassRefPtr<RTCStatsCallback> successCallback, PassRefPtr<MediaStreamTrack> selector);
+
     void close(ExceptionCode&);
 
     DEFINE_ATTRIBUTE_EVENT_LISTENER(negotiationneeded);
index bc4390f..56df47a 100644 (file)
@@ -72,6 +72,8 @@ module mediastream {
         [StrictTypeChecking] void removeStream(in MediaStream stream)
             raises(DOMException);
 
+        void getStats(in [Callback] RTCStatsCallback successCallback, in [Optional=DefaultIsUndefined] MediaStreamTrack selector);
+
         void close()
             raises(DOMException);
 
diff --git a/Source/WebCore/Modules/mediastream/RTCStatsCallback.h b/Source/WebCore/Modules/mediastream/RTCStatsCallback.h
new file mode 100644 (file)
index 0000000..419b820
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RTCStatsCallback_h
+#define RTCStatsCallback_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class RTCStatsResponse;
+
+class RTCStatsCallback : public RefCounted<RTCStatsCallback> {
+public:
+    virtual ~RTCStatsCallback() { }
+    virtual bool handleEvent(RTCStatsResponse*) = 0;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // RTCStatsCallback_h
diff --git a/Source/WebCore/Modules/mediastream/RTCStatsCallback.idl b/Source/WebCore/Modules/mediastream/RTCStatsCallback.idl
new file mode 100644 (file)
index 0000000..9829c18
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module mediastream {
+
+    interface [
+        Conditional=MEDIA_STREAM,
+        Callback
+    ] RTCStatsCallback {
+        boolean handleEvent(in RTCStatsResponse response);
+    };
+
+}
diff --git a/Source/WebCore/Modules/mediastream/RTCStatsElement.cpp b/Source/WebCore/Modules/mediastream/RTCStatsElement.cpp
new file mode 100644 (file)
index 0000000..e78cc0b
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "RTCStatsElement.h"
+
+#include <wtf/text/StringHash.h>
+
+namespace WebCore {
+
+PassRefPtr<RTCStatsElement> RTCStatsElement::create(long timestamp)
+{
+    return adoptRef(new RTCStatsElement(timestamp));
+}
+
+RTCStatsElement::RTCStatsElement(long timestamp)
+    : m_timestamp(timestamp)
+{
+}
+
+String RTCStatsElement::stat(const String& name) const
+{
+    return m_stats.get(name);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
diff --git a/Source/WebCore/Modules/mediastream/RTCStatsElement.h b/Source/WebCore/Modules/mediastream/RTCStatsElement.h
new file mode 100644 (file)
index 0000000..09ebed2
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RTCStatsElement_h
+#define RTCStatsElement_h
+
+#include <wtf/HashMap.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class RTCStatsElement : public RefCounted<RTCStatsElement> {
+public:
+    static PassRefPtr<RTCStatsElement> create(long timestamp);
+    long timestamp() const { return m_timestamp; }
+    String stat(const String& name) const;
+
+private:
+    explicit RTCStatsElement(long timestamp);
+
+    long m_timestamp;
+    HashMap<String, String> m_stats;
+};
+
+} // namespace WebCore
+
+#endif // RTCStatsElement_h
diff --git a/Source/WebCore/Modules/mediastream/RTCStatsElement.idl b/Source/WebCore/Modules/mediastream/RTCStatsElement.idl
new file mode 100644 (file)
index 0000000..c1b0948
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module mediastream {
+
+    interface [
+        Conditional=MEDIA_STREAM,
+    ] RTCStatsElement {
+        readonly attribute long timestamp;
+        DOMString stat(in DOMString name);
+    };
+}
diff --git a/Source/WebCore/Modules/mediastream/RTCStatsReport.cpp b/Source/WebCore/Modules/mediastream/RTCStatsReport.cpp
new file mode 100644 (file)
index 0000000..d982dd7
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "RTCStatsReport.h"
+
+namespace WebCore {
+
+PassRefPtr<RTCStatsReport> RTCStatsReport::create()
+{
+    return adoptRef(new RTCStatsReport());
+}
+
+RTCStatsReport::RTCStatsReport()
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
diff --git a/Source/WebCore/Modules/mediastream/RTCStatsReport.h b/Source/WebCore/Modules/mediastream/RTCStatsReport.h
new file mode 100644 (file)
index 0000000..cb2cf03
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RTCStatsReport_h
+#define RTCStatsReport_h
+
+#include "RTCStatsElement.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class RTCStatsReport : public RefCounted<RTCStatsReport> {
+public:
+    static PassRefPtr<RTCStatsReport> create();
+
+    const Vector<RefPtr<RTCStatsElement> >& local() const { return m_local; }
+    const Vector<RefPtr<RTCStatsElement> >& remote() const { return m_remote; }
+
+private:
+    RTCStatsReport();
+
+    Vector<RefPtr<RTCStatsElement> > m_local;
+    Vector<RefPtr<RTCStatsElement> > m_remote;
+};
+
+} // namespace WebCore
+
+#endif // RTCStatsReport_h
diff --git a/Source/WebCore/Modules/mediastream/RTCStatsReport.idl b/Source/WebCore/Modules/mediastream/RTCStatsReport.idl
new file mode 100644 (file)
index 0000000..368b472
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module mediastream {
+
+    interface [
+        Conditional=MEDIA_STREAM
+    ] RTCStatsReport {
+        sequence<RTCStatsElement> local();
+        sequence<RTCStatsElement> remote();
+    };
+}
diff --git a/Source/WebCore/Modules/mediastream/RTCStatsRequestImpl.cpp b/Source/WebCore/Modules/mediastream/RTCStatsRequestImpl.cpp
new file mode 100644 (file)
index 0000000..afdb97f
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "RTCStatsRequestImpl.h"
+
+#include "RTCStatsCallback.h"
+#include "RTCStatsRequest.h"
+#include "RTCStatsResponse.h"
+
+namespace WebCore {
+
+PassRefPtr<RTCStatsRequestImpl> RTCStatsRequestImpl::create(ScriptExecutionContext* context, PassRefPtr<RTCStatsCallback> callback)
+{
+    RefPtr<RTCStatsRequestImpl> request = adoptRef(new RTCStatsRequestImpl(context, callback));
+    request->suspendIfNeeded();
+    return request.release();
+}
+
+RTCStatsRequestImpl::RTCStatsRequestImpl(ScriptExecutionContext* context, PassRefPtr<RTCStatsCallback> callback)
+    : ActiveDOMObject(context, this)
+    , m_successCallback(callback)
+{
+}
+
+RTCStatsRequestImpl::~RTCStatsRequestImpl()
+{
+}
+
+void RTCStatsRequestImpl::requestSucceeded()
+{
+    if (!m_successCallback)
+        return;
+    // FIXME: Fill in content of stats parameter.
+    RefPtr<RTCStatsResponse> stats = RTCStatsResponse::create();
+    m_successCallback->handleEvent(stats.get());
+    clear();
+}
+
+void RTCStatsRequestImpl::stop()
+{
+    clear();
+}
+
+void RTCStatsRequestImpl::clear()
+{
+    m_successCallback.clear();
+}
+
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
diff --git a/Source/WebCore/Modules/mediastream/RTCStatsRequestImpl.h b/Source/WebCore/Modules/mediastream/RTCStatsRequestImpl.h
new file mode 100644 (file)
index 0000000..47663a7
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RTCStatsRequestImpl_h
+#define RTCStatsRequestImpl_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "ActiveDOMObject.h"
+#include "RTCStatsRequest.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class RTCStatsCallback;
+
+class RTCStatsRequestImpl : public RTCStatsRequest, public ActiveDOMObject {
+public:
+    static PassRefPtr<RTCStatsRequestImpl> create(ScriptExecutionContext*, PassRefPtr<RTCStatsCallback>);
+    virtual ~RTCStatsRequestImpl();
+
+    virtual void requestSucceeded();
+
+    // ActiveDOMObject
+    virtual void stop() OVERRIDE;
+
+private:
+    RTCStatsRequestImpl(ScriptExecutionContext*, PassRefPtr<RTCStatsCallback>);
+
+    void clear();
+
+    RefPtr<RTCStatsCallback> m_successCallback;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // RTCStatsRequestImpl_h
diff --git a/Source/WebCore/Modules/mediastream/RTCStatsResponse.cpp b/Source/WebCore/Modules/mediastream/RTCStatsResponse.cpp
new file mode 100644 (file)
index 0000000..ff78f11
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+#include "RTCStatsResponse.h"
+
+namespace WebCore {
+
+PassRefPtr<RTCStatsResponse> RTCStatsResponse::create()
+{
+    return adoptRef(new RTCStatsResponse());
+    // FIXME: Pass an RTCStatsRequest argument and populate from it.
+}
+
+RTCStatsResponse::RTCStatsResponse()
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
diff --git a/Source/WebCore/Modules/mediastream/RTCStatsResponse.h b/Source/WebCore/Modules/mediastream/RTCStatsResponse.h
new file mode 100644 (file)
index 0000000..c2ecc90
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RTCStatsResponse_h
+#define RTCStatsResponse_h
+
+#include "ActiveDOMObject.h"
+#include "DOMError.h"
+#include "DOMStringList.h"
+#include "Event.h"
+#include "EventListener.h"
+#include "EventNames.h"
+#include "EventTarget.h"
+#include "MediaStreamTrack.h"
+#include "RTCStatsReport.h"
+
+namespace WebCore {
+
+class RTCStatsResponse : public RefCounted<RTCStatsResponse> {
+public:
+    static PassRefPtr<RTCStatsResponse> create();
+
+    const Vector<RefPtr<RTCStatsReport> >& result() const { return m_result; };
+
+private:
+    RTCStatsResponse();
+    Vector<RefPtr<RTCStatsReport> > m_result;
+};
+
+} // namespace WebCore
+
+#endif // RTCStatsResponse_h
diff --git a/Source/WebCore/Modules/mediastream/RTCStatsResponse.idl b/Source/WebCore/Modules/mediastream/RTCStatsResponse.idl
new file mode 100644 (file)
index 0000000..a2ecc67
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module mediastream {
+
+    interface [
+        Conditional=MEDIA_STREAM
+    ] RTCStatsResponse {
+        sequence<RTCStatsReport> result();
+    };
+}
index 198b934..2f0a63a 100644 (file)
             'platform/mediastream/RTCSessionDescriptionDescriptor.cpp',
             'platform/mediastream/RTCSessionDescriptionDescriptor.h',
             'platform/mediastream/RTCSessionDescriptionRequest.h',
+            'platform/mediastream/RTCStatsRequest.h',
             'platform/mediastream/RTCVoidRequest.h',
             'platform/mediastream/SessionDescriptionDescriptor.cpp',
             'platform/mediastream/SessionDescriptionDescriptor.h',
             'Modules/mediastream/RTCPeerConnection.idl',
             'Modules/mediastream/RTCSessionDescription.idl',
             'Modules/mediastream/RTCSessionDescriptionCallback.idl',
+            'Modules/mediastream/RTCStatsCallback.idl',
+            'Modules/mediastream/RTCStatsElement.idl',
+            'Modules/mediastream/RTCStatsReport.idl',
+            'Modules/mediastream/RTCStatsResponse.idl',
             'Modules/mediastream/SessionDescription.idl',
             'Modules/navigatorcontentutils/NavigatorContentUtils.idl',
             'Modules/notifications/DOMWindowNotifications.idl',
             'Modules/mediastream/RTCSessionDescriptionCallback.h',
             'Modules/mediastream/RTCSessionDescriptionRequestImpl.cpp',
             'Modules/mediastream/RTCSessionDescriptionRequestImpl.h',
+            'Modules/mediastream/RTCStatsElement.cpp',
+            'Modules/mediastream/RTCStatsElement.h',
+            'Modules/mediastream/RTCStatsReport.cpp',
+            'Modules/mediastream/RTCStatsReport.h',
+            'Modules/mediastream/RTCStatsRequestImpl.cpp',
+            'Modules/mediastream/RTCStatsRequestImpl.h',
+            'Modules/mediastream/RTCStatsResponse.cpp',
+            'Modules/mediastream/RTCStatsResponse.h',
             'Modules/mediastream/RTCVoidRequestImpl.cpp',
             'Modules/mediastream/RTCVoidRequestImpl.h',
             'Modules/mediastream/SessionDescription.cpp',
             'platform/chromium/support/WebRTCICECandidate.cpp',
             'platform/chromium/support/WebRTCSessionDescription.cpp',
             'platform/chromium/support/WebRTCSessionDescriptionRequest.cpp',
+            'platform/chromium/support/WebRTCStatsRequest.cpp',
             'platform/chromium/support/WebRTCVoidRequest.cpp',
             'platform/chromium/support/WebScrollbarThemeGeometryNative.cpp',
             'platform/chromium/support/WebScrollbarThemeGeometryNative.h',
diff --git a/Source/WebCore/platform/chromium/support/WebRTCStatsRequest.cpp b/Source/WebCore/platform/chromium/support/WebRTCStatsRequest.cpp
new file mode 100644 (file)
index 0000000..df65ae6
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(MEDIA_STREAM)
+
+#include <public/WebRTCStatsRequest.h>
+
+#include "RTCStatsRequest.h"
+#include <wtf/PassOwnPtr.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebRTCStatsRequest::WebRTCStatsRequest(const PassRefPtr<RTCStatsRequest>& request)
+    : m_private(request)
+{
+}
+
+void WebRTCStatsRequest::assign(const WebRTCStatsRequest& other)
+{
+    m_private = other.m_private;
+}
+
+void WebRTCStatsRequest::reset()
+{
+    m_private.reset();
+}
+
+void WebRTCStatsRequest::requestSucceeded() const
+{
+    m_private->requestSucceeded();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(MEDIA_STREAM)
+
index dfd5d18..663fbc8 100644 (file)
@@ -59,6 +59,7 @@ public:
     virtual bool addIceCandidate(PassRefPtr<RTCIceCandidateDescriptor>) OVERRIDE;
     virtual bool addStream(PassRefPtr<MediaStreamDescriptor>, PassRefPtr<MediaConstraints>) OVERRIDE;
     virtual void removeStream(PassRefPtr<MediaStreamDescriptor>) OVERRIDE;
+    virtual void getStats(PassRefPtr<RTCStatsRequest>) OVERRIDE;
     virtual void stop() OVERRIDE;
 
 private:
@@ -130,6 +131,10 @@ bool RTCPeerConnectionHandlerDummy::addIceCandidate(PassRefPtr<RTCIceCandidateDe
     return false;
 }
 
+void RTCPeerConnectionHandlerDummy::getStats(PassRefPtr<RTCStatsRequest>)
+{
+}
+
 void RTCPeerConnectionHandlerDummy::stop()
 {
 }
index 18021c5..e690705 100644 (file)
@@ -45,6 +45,7 @@ class RTCIceCandidateDescriptor;
 class RTCPeerConnectionHandlerClient;
 class RTCSessionDescriptionDescriptor;
 class RTCSessionDescriptionRequest;
+class RTCStatsRequest;
 class RTCVoidRequest;
 
 class RTCPeerConnectionHandler {
@@ -64,6 +65,7 @@ public:
     virtual bool addIceCandidate(PassRefPtr<RTCIceCandidateDescriptor>) = 0;
     virtual bool addStream(PassRefPtr<MediaStreamDescriptor>, PassRefPtr<MediaConstraints>) = 0;
     virtual void removeStream(PassRefPtr<MediaStreamDescriptor>) = 0;
+    virtual void getStats(PassRefPtr<RTCStatsRequest>) = 0;
     virtual void stop() = 0;
 
 protected:
diff --git a/Source/WebCore/platform/mediastream/RTCStatsRequest.h b/Source/WebCore/platform/mediastream/RTCStatsRequest.h
new file mode 100644 (file)
index 0000000..6ece764
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer
+ *    in the documentation and/or other materials provided with the
+ *    distribution.
+ * 3. Neither the name of Google Inc. nor the names of its contributors
+ *    may be used to endorse or promote products derived from this
+ *    software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RTCStatsRequest_h
+#define RTCStatsRequest_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class RTCStatsRequest : public RefCounted<RTCStatsRequest> {
+public:
+    virtual ~RTCStatsRequest() { }
+
+    virtual void requestSucceeded() = 0;
+
+protected:
+    RTCStatsRequest() { }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // RTCStatsRequest_h
index 08a0373..ccf8aa6 100644 (file)
@@ -48,6 +48,7 @@
 #include <public/WebRTCICECandidate.h>
 #include <public/WebRTCSessionDescription.h>
 #include <public/WebRTCSessionDescriptionRequest.h>
+#include <public/WebRTCStatsRequest.h>
 #include <public/WebRTCVoidRequest.h>
 #include <wtf/PassOwnPtr.h>
 
@@ -156,6 +157,14 @@ void RTCPeerConnectionHandlerChromium::removeStream(PassRefPtr<MediaStreamDescri
     m_webHandler->removeStream(mediaStream);
 }
 
+void RTCPeerConnectionHandlerChromium::getStats(PassRefPtr<RTCStatsRequest> request)
+{
+    if (!m_webHandler)
+        return;
+
+    m_webHandler->getStats(request);
+}
+
 void RTCPeerConnectionHandlerChromium::stop()
 {
     if (!m_webHandler)
index 5f69471..ef1cd1d 100644 (file)
@@ -64,6 +64,7 @@ public:
     virtual bool addIceCandidate(PassRefPtr<RTCIceCandidateDescriptor>) OVERRIDE;
     virtual bool addStream(PassRefPtr<MediaStreamDescriptor>, PassRefPtr<MediaConstraints>) OVERRIDE;
     virtual void removeStream(PassRefPtr<MediaStreamDescriptor>) OVERRIDE;
+    virtual void getStats(PassRefPtr<RTCStatsRequest>) OVERRIDE;
     virtual void stop() OVERRIDE;
 
     // WebKit::WebRTCPeerConnectionHandlerClient implementation.
index 9f04d4c..25aef5c 100644 (file)
@@ -1,3 +1,17 @@
+2012-09-26  Harald Tveit Alvestrand  <harald@alvestrand.no>
+
+        Implement the GetStats interface on PeerConnection
+        https://bugs.webkit.org/show_bug.cgi?id=95193
+
+        Reviewed by Adam Barth.
+
+        * DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp:
+        (RTCStatsRequestSucceededTask):
+        (RTCStatsRequestSucceededTask::RTCStatsRequestSucceededTask):
+        (MockWebRTCPeerConnectionHandler::getStats):
+        * DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h:
+        (MockWebRTCPeerConnectionHandler):
+
 2012-09-26  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
 
         [WK2][WTR] Policy client: dumping from decidePolicyForResponse callback
index b2d50fe..ffb16e5 100644 (file)
@@ -37,6 +37,7 @@
 #include <public/WebRTCPeerConnectionHandlerClient.h>
 #include <public/WebRTCSessionDescription.h>
 #include <public/WebRTCSessionDescriptionRequest.h>
+#include <public/WebRTCStatsRequest.h>
 #include <public/WebRTCVoidRequest.h>
 #include <public/WebString.h>
 #include <public/WebVector.h>
@@ -79,6 +80,23 @@ private:
     WebKit::WebRTCSessionDescriptionRequest m_request;
 };
 
+class RTCStatsRequestSucceededTask : public MethodTask<MockWebRTCPeerConnectionHandler> {
+public:
+    RTCStatsRequestSucceededTask(MockWebRTCPeerConnectionHandler* object, const WebKit::WebRTCStatsRequest& request)
+        : MethodTask<MockWebRTCPeerConnectionHandler>(object)
+        , m_request(request)
+    {
+    }
+
+    virtual void runIfValid() OVERRIDE
+    {
+        m_request.requestSucceeded();
+    }
+
+private:
+    WebKit::WebRTCStatsRequest m_request;
+};
+
 class RTCVoidRequestTask : public MethodTask<MockWebRTCPeerConnectionHandler> {
 public:
     RTCVoidRequestTask(MockWebRTCPeerConnectionHandler* object, const WebKit::WebRTCVoidRequest& request, bool succeeded)
@@ -223,6 +241,12 @@ void MockWebRTCPeerConnectionHandler::removeStream(const WebMediaStreamDescripto
     m_client->negotiationNeeded();
 }
 
+void MockWebRTCPeerConnectionHandler::getStats(const WebRTCStatsRequest& request)
+{
+    postTask(new RTCStatsRequestSucceededTask(this, request));
+}
+
+
 void MockWebRTCPeerConnectionHandler::stop()
 {
 }
index 2bf139a..8aa336e 100644 (file)
@@ -37,6 +37,7 @@
 #include <public/WebRTCPeerConnectionHandler.h>
 #include <public/WebRTCSessionDescription.h>
 #include <public/WebRTCSessionDescriptionRequest.h>
+#include <public/WebRTCStatsRequest.h>
 
 namespace WebKit {
 class WebRTCPeerConnectionHandlerClient;
@@ -58,6 +59,7 @@ public:
     virtual bool addICECandidate(const WebKit::WebRTCICECandidate&) OVERRIDE;
     virtual bool addStream(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaConstraints&) OVERRIDE;
     virtual void removeStream(const WebKit::WebMediaStreamDescriptor&) OVERRIDE;
+    virtual void getStats(const WebKit::WebRTCStatsRequest&) OVERRIDE;
     virtual void stop() OVERRIDE;
 
     // Task related methods