Diff
Modified: trunk/LayoutTests/ChangeLog (130259 => 130260)
--- trunk/LayoutTests/ChangeLog 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/LayoutTests/ChangeLog 2012-10-03 08:01:25 UTC (rev 130260)
@@ -1,3 +1,13 @@
+2012-10-03 Harald Alvestrand <[email protected]>
+
+ Add data passing to the GetStats interface of RTCPeerConnection
+ https://bugs.webkit.org/show_bug.cgi?id=98003
+
+ Reviewed by Adam Barth.
+
+ * fast/mediastream/RTCPeerConnection-stats-expected.txt:
+ * fast/mediastream/RTCPeerConnection-stats.html:
+
2012-10-02 Arko Saha <[email protected]>
Microdata: itemprop names must not override builtin properties.
Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats-expected.txt (130259 => 130260)
--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats-expected.txt 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats-expected.txt 2012-10-03 08:01:25 UTC (rev 130260)
@@ -4,10 +4,17 @@
PASS pc = new webkitRTCPeerConnection(null) did not throw exception.
-PASS pc.getStats(statsHandler) did not throw exception.
-PASS statsHandler was called
+PASS pc.getStats(statsHandler1) did not throw exception.
+PASS statsHandler1 was called
PASS status is non-null.
PASS result.length is 0
+PASS getUserMedia({audio:true, video:true}, gotStream) did not throw exception.
+PASS Got a stream.
+PASS pc.getStats(statsHandler2) did not throw exception.
+PASS statsHandler2 was called
+PASS result.length is >= 2
+PASS local.length is 1
+PASS local[0].stat("type") is "audio"
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats.html (130259 => 130260)
--- trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats.html 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/LayoutTests/fast/mediastream/RTCPeerConnection-stats.html 2012-10-03 08:01:25 UTC (rev 130260)
@@ -8,18 +8,53 @@
description("Tests the RTCPeerConnection stats interface.");
var pc = null;
+var result;
+var local;
-function statsHandler(status)
+function getUserMedia(dictionary, callback) {
+ try {
+ navigator.webkitGetUserMedia(dictionary, callback, error);
+ } catch (e) {
+ testFailed('webkitGetUserMedia threw exception :' + e);
+ finishJSTest();
+ }
+}
+
+function error() {
+ testFailed('Stream generation failed.');
+ finishJSTest();
+}
+
+function statsHandler1(status)
{
- testPassed("statsHandler was called");
+ testPassed("statsHandler1 was called");
shouldBeNonNull('status');
result = status.result();
shouldBe('result.length', '0');
+ shouldNotThrow('getUserMedia({audio:true, video:true}, gotStream)');
+}
+
+function gotStream(s) {
+ testPassed('Got a stream.');
+ stream = s;
+
+ pc.addStream(stream);
+ shouldNotThrow('pc.getStats(statsHandler2)');
+}
+
+function statsHandler2(status)
+{
+ testPassed("statsHandler2 was called");
+ result = status.result();
+ shouldBeGreaterThanOrEqual('result.length', '2');
+ local = result[0].local();
+ shouldBe('local.length', '1');
+ shouldBe('local[0].stat("type")', '"audio"');
finishJSTest();
}
shouldNotThrow('pc = new webkitRTCPeerConnection(null)');
-shouldNotThrow('pc.getStats(statsHandler)');
+shouldNotThrow('pc.getStats(statsHandler1)');
window.jsTestIsAsync = true;
window.successfullyParsed = true;
Modified: trunk/Source/Platform/ChangeLog (130259 => 130260)
--- trunk/Source/Platform/ChangeLog 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Source/Platform/ChangeLog 2012-10-03 08:01:25 UTC (rev 130260)
@@ -1,3 +1,22 @@
+2012-10-03 Harald Alvestrand <[email protected]>
+
+ Add data passing to the GetStats interface of RTCPeerConnection
+ https://bugs.webkit.org/show_bug.cgi?id=98003
+
+ Reviewed by Adam Barth.
+
+ * Platform.gypi:
+ * chromium/public/WebRTCStatsRequest.h:
+ (WebKit):
+ (WebRTCStatsRequest):
+ * chromium/public/WebRTCStatsResponse.h: Added.
+ (WebCore):
+ (WebKit):
+ (WebRTCStatsResponse):
+ (WebKit::WebRTCStatsResponse::WebRTCStatsResponse):
+ (WebKit::WebRTCStatsResponse::~WebRTCStatsResponse):
+ (WebKit::WebRTCStatsResponse::operator=):
+
2012-10-02 Terry Anderson <[email protected]>
[chromium] Add field to WebRenderingStats to track if we have impl-thread scrolled
Modified: trunk/Source/Platform/Platform.gypi (130259 => 130260)
--- trunk/Source/Platform/Platform.gypi 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Source/Platform/Platform.gypi 2012-10-03 08:01:25 UTC (rev 130260)
@@ -112,6 +112,8 @@
'chromium/public/WebRTCPeerConnectionHandlerClient.h',
'chromium/public/WebRTCSessionDescription.h',
'chromium/public/WebRTCSessionDescriptionRequest.h',
+ 'chromium/public/WebRTCStatsRequest.h',
+ 'chromium/public/WebRTCStatsResponse.h',
'chromium/public/WebRTCVoidRequest.h',
'chromium/public/WebRect.h',
'chromium/public/WebReferrerPolicy.h',
Modified: trunk/Source/Platform/chromium/public/WebRTCStatsRequest.h (130259 => 130260)
--- trunk/Source/Platform/chromium/public/WebRTCStatsRequest.h 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Source/Platform/chromium/public/WebRTCStatsRequest.h 2012-10-03 08:01:25 UTC (rev 130260)
@@ -41,6 +41,29 @@
namespace WebKit {
+class WebRTCStatsResponse;
+
+// The WebRTCStatsRequest class represents a _javascript_ call on
+// RTCPeerConnection.getStats(). The user of this API will use
+// the calls on this class and WebRTCStatsResponse to fill in the
+// data that will be returned via a callback to the user in an
+// RTCStatsResponse structure.
+//
+// The typical usage pattern is:
+// WebRTCStatsRequest request = <from somewhere>
+// WebRTCStatsResponse response = request.createResponse();
+//
+// For each item on which statistics are going to be reported:
+// size_t reportIndex = response.addReport();
+// Add local information:
+// size_t elementIndex = response.addElement(reportIndex, true, dateNow());
+// For each statistic being reported on:
+// response.addStatistic(reportIndex, true, elementIndex,
+// "name of statistic", "statistic value");
+// Remote information (typically RTCP-derived) is added in the same way.
+// When finished adding information:
+// request.requestSucceeded(response);
+
class WebRTCStatsRequest {
public:
WebRTCStatsRequest() { }
@@ -57,8 +80,10 @@
WEBKIT_EXPORT void reset();
- WEBKIT_EXPORT void requestSucceeded() const;
+ WEBKIT_EXPORT void requestSucceeded(const WebRTCStatsResponse&) const;
+ WEBKIT_EXPORT WebRTCStatsResponse createResponse() const;
+
#if WEBKIT_IMPLEMENTATION
WebRTCStatsRequest(const WTF::PassRefPtr<WebCore::RTCStatsRequest>&);
#endif
Copied: trunk/Source/Platform/chromium/public/WebRTCStatsResponse.h (from rev 130259, trunk/Source/WebCore/Modules/mediastream/RTCStatsRequestImpl.h) (0 => 130260)
--- trunk/Source/Platform/chromium/public/WebRTCStatsResponse.h (rev 0)
+++ trunk/Source/Platform/chromium/public/WebRTCStatsResponse.h 2012-10-03 08:01:25 UTC (rev 130260)
@@ -0,0 +1,70 @@
+/*
+ * 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 WebRTCStatsResponse_h
+#define WebRTCStatsResponse_h
+
+#include "WebCommon.h"
+#include "WebPrivatePtr.h"
+#include "WebString.h"
+
+namespace WebCore {
+class RTCStatsResponseBase;
+}
+
+namespace WebKit {
+
+class WebRTCStatsResponse {
+public:
+ WebRTCStatsResponse() { }
+ WebRTCStatsResponse(const WebRTCStatsResponse& other) { assign(other); }
+ ~WebRTCStatsResponse() { reset(); }
+
+ WebRTCStatsResponse& operator=(const WebRTCStatsResponse& other)
+ {
+ assign(other);
+ return *this;
+ }
+
+ WEBKIT_EXPORT void assign(const WebRTCStatsResponse&);
+
+ WEBKIT_EXPORT void reset();
+
+ WEBKIT_EXPORT size_t addReport();
+ WEBKIT_EXPORT size_t addElement(size_t report, bool isLocal, long timestamp);
+ WEBKIT_EXPORT void addStatistic(size_t report, bool isLocal, size_t element, WebString name, WebString value);
+
+#if WEBKIT_IMPLEMENTATION
+ WebRTCStatsResponse(const WTF::PassRefPtr<WebCore::RTCStatsResponseBase>&);
+
+ operator WTF::PassRefPtr<WebCore::RTCStatsResponseBase>() const;
+#endif
+
+private:
+ WebPrivatePtr<WebCore::RTCStatsResponseBase> m_private;
+};
+
+} // namespace WebKit
+
+#endif // WebRTCStatsResponse_h
Modified: trunk/Source/WebCore/ChangeLog (130259 => 130260)
--- trunk/Source/WebCore/ChangeLog 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Source/WebCore/ChangeLog 2012-10-03 08:01:25 UTC (rev 130260)
@@ -1,3 +1,63 @@
+2012-10-03 Harald Alvestrand <[email protected]>
+
+ Add data passing to the GetStats interface of RTCPeerConnection
+ https://bugs.webkit.org/show_bug.cgi?id=98003
+
+ Reviewed by Adam Barth.
+
+ Added an RTCStatsResponseBase interface to platform, and let the
+ RTCStatsRequestImpl class produce an implementation of it that's returned
+ to WebCore.
+
+ Tested by extension of the RTCPeerConnection-stats.html test.
+
+ * Modules/mediastream/RTCStatsElement.cpp:
+ (WebCore::RTCStatsElement::addStatistic):
+ (WebCore):
+ * Modules/mediastream/RTCStatsElement.h:
+ (RTCStatsElement):
+ * Modules/mediastream/RTCStatsReport.cpp:
+ (WebCore):
+ (WebCore::RTCStatsReport::addElement):
+ (WebCore::RTCStatsReport::addStatistic):
+ * Modules/mediastream/RTCStatsReport.h:
+ (RTCStatsReport):
+ * Modules/mediastream/RTCStatsRequestImpl.cpp:
+ (WebCore::RTCStatsRequestImpl::createResponse):
+ (WebCore):
+ (WebCore::RTCStatsRequestImpl::requestSucceeded):
+ * Modules/mediastream/RTCStatsRequestImpl.h:
+ (RTCStatsRequestImpl):
+ * Modules/mediastream/RTCStatsResponse.cpp:
+ (WebCore::RTCStatsResponse::create):
+ (WebCore::RTCStatsResponse::addReport):
+ (WebCore):
+ (WebCore::RTCStatsResponse::addElement):
+ (WebCore::RTCStatsResponse::addStatistic):
+ * Modules/mediastream/RTCStatsResponse.h:
+ (RTCStatsResponse):
+ * WebCore.gypi:
+ * platform/chromium/support/WebRTCStatsRequest.cpp:
+ (WebKit::WebRTCStatsRequest::response):
+ (WebKit):
+ (WebKit::WebRTCStatsRequest::requestSucceeded):
+ * platform/chromium/support/WebRTCStatsResponse.cpp: Added.
+ (WebKit):
+ (WebKit::WebRTCStatsResponse::WebRTCStatsResponse):
+ (WebKit::WebRTCStatsResponse::assign):
+ (WebKit::WebRTCStatsResponse::reset):
+ (WebKit::WebRTCStatsResponse::operator WTF::PassRefPtr<WebCore::RTCStatsResponseBase>):
+ (WebKit::WebRTCStatsResponse::addReport):
+ (WebKit::WebRTCStatsResponse::addElement):
+ (WebKit::WebRTCStatsResponse::addStatistic):
+ * platform/mediastream/RTCStatsRequest.h:
+ (WebCore):
+ (RTCStatsRequest):
+ * platform/mediastream/RTCStatsResponseBase.h: Added.
+ (WebCore):
+ (RTCStatsResponseBase):
+ (WebCore::RTCStatsResponseBase::~RTCStatsResponseBase):
+
2012-10-02 Carlos Garcia Campos <[email protected]>
[GTK] Add API to get the web view that initiated a custom URI request to WebKit2 GTK+
Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.cpp (130259 => 130260)
--- trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.cpp 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.cpp 2012-10-03 08:01:25 UTC (rev 130260)
@@ -47,6 +47,11 @@
return m_stats.get(name);
}
+void RTCStatsElement::addStatistic(const String& name, const String& value)
+{
+ m_stats.add(name, value);
+}
+
} // namespace WebCore
#endif // ENABLE(MEDIA_STREAM)
Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.h (130259 => 130260)
--- trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.h 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.h 2012-10-03 08:01:25 UTC (rev 130260)
@@ -37,6 +37,7 @@
static PassRefPtr<RTCStatsElement> create(long timestamp);
long timestamp() const { return m_timestamp; }
String stat(const String& name) const;
+ void addStatistic(const String& name, const String& value);
private:
explicit RTCStatsElement(long timestamp);
Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.cpp (130259 => 130260)
--- trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.cpp 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.cpp 2012-10-03 08:01:25 UTC (rev 130260)
@@ -39,6 +39,27 @@
{
}
+size_t RTCStatsReport::addElement(bool isLocal, long timestamp)
+{
+ if (isLocal) {
+ m_local.append(RTCStatsElement::create(timestamp));
+ return m_local.size() - 1;
+ }
+ m_remote.append(RTCStatsElement::create(timestamp));
+ return m_remote.size() - 1;
+}
+
+void RTCStatsReport::addStatistic(bool isLocal, size_t element, String name, String value)
+{
+ if (isLocal) {
+ ASSERT(element >= 0 && element < m_local.size());
+ m_local[element]->addStatistic(name, value);
+ } else {
+ ASSERT(element >= 0 && element < m_remote.size());
+ m_remote[element]->addStatistic(name, value);
+ }
+}
+
} // namespace WebCore
#endif // ENABLE(MEDIA_STREAM)
Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h (130259 => 130260)
--- trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsReport.h 2012-10-03 08:01:25 UTC (rev 130260)
@@ -40,6 +40,9 @@
const Vector<RefPtr<RTCStatsElement> >& local() const { return m_local; }
const Vector<RefPtr<RTCStatsElement> >& remote() const { return m_remote; }
+ size_t addElement(bool isLocal, long timestamp);
+ void addStatistic(bool isLocal, size_t element, String name, String value);
+
private:
RTCStatsReport();
Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsRequestImpl.cpp (130259 => 130260)
--- trunk/Source/WebCore/Modules/mediastream/RTCStatsRequestImpl.cpp 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsRequestImpl.cpp 2012-10-03 08:01:25 UTC (rev 130260)
@@ -51,13 +51,16 @@
{
}
-void RTCStatsRequestImpl::requestSucceeded()
+PassRefPtr<RTCStatsResponseBase> RTCStatsRequestImpl::createResponse()
{
+ return RTCStatsResponse::create();
+}
+
+void RTCStatsRequestImpl::requestSucceeded(PassRefPtr<RTCStatsResponseBase> response)
+{
if (!m_successCallback)
return;
- // FIXME: Fill in content of stats parameter.
- RefPtr<RTCStatsResponse> stats = RTCStatsResponse::create();
- m_successCallback->handleEvent(stats.get());
+ m_successCallback->handleEvent(static_cast<RTCStatsResponse*>(response.get()));
clear();
}
Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsRequestImpl.h (130259 => 130260)
--- trunk/Source/WebCore/Modules/mediastream/RTCStatsRequestImpl.h 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsRequestImpl.h 2012-10-03 08:01:25 UTC (rev 130260)
@@ -29,6 +29,7 @@
#include "ActiveDOMObject.h"
#include "RTCStatsRequest.h"
+#include "RTCStatsResponse.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
@@ -42,7 +43,8 @@
static PassRefPtr<RTCStatsRequestImpl> create(ScriptExecutionContext*, PassRefPtr<RTCStatsCallback>);
virtual ~RTCStatsRequestImpl();
- virtual void requestSucceeded();
+ virtual PassRefPtr<RTCStatsResponseBase> createResponse();
+ virtual void requestSucceeded(PassRefPtr<RTCStatsResponseBase>);
// ActiveDOMObject
virtual void stop() OVERRIDE;
Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsResponse.cpp (130259 => 130260)
--- trunk/Source/WebCore/Modules/mediastream/RTCStatsResponse.cpp 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsResponse.cpp 2012-10-03 08:01:25 UTC (rev 130260)
@@ -33,13 +33,30 @@
PassRefPtr<RTCStatsResponse> RTCStatsResponse::create()
{
return adoptRef(new RTCStatsResponse());
- // FIXME: Pass an RTCStatsRequest argument and populate from it.
}
RTCStatsResponse::RTCStatsResponse()
{
}
+size_t RTCStatsResponse::addReport()
+{
+ m_result.append(RTCStatsReport::create());
+ return m_result.size() - 1;
+}
+
+size_t RTCStatsResponse::addElement(size_t report, bool isLocal, long timestamp)
+{
+ ASSERT(report >= 0 && report < m_result.size());
+ return m_result[report]->addElement(isLocal, timestamp);
+}
+
+void RTCStatsResponse::addStatistic(size_t report, bool isLocal, size_t element, String name, String value)
+{
+ ASSERT(report >= 0 && report < m_result.size());
+ return m_result[report]->addStatistic(isLocal, element, name, value);
+}
+
} // namespace WebCore
#endif // ENABLE(MEDIA_STREAM)
Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsResponse.h (130259 => 130260)
--- trunk/Source/WebCore/Modules/mediastream/RTCStatsResponse.h 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsResponse.h 2012-10-03 08:01:25 UTC (rev 130260)
@@ -34,15 +34,20 @@
#include "EventTarget.h"
#include "MediaStreamTrack.h"
#include "RTCStatsReport.h"
+#include "RTCStatsResponseBase.h"
namespace WebCore {
-class RTCStatsResponse : public RefCounted<RTCStatsResponse> {
+class RTCStatsResponse : public RTCStatsResponseBase {
public:
static PassRefPtr<RTCStatsResponse> create();
const Vector<RefPtr<RTCStatsReport> >& result() const { return m_result; };
+ virtual size_t addReport() OVERRIDE;
+ virtual size_t addElement(size_t report, bool isLocal, long timestamp) OVERRIDE;
+ virtual void addStatistic(size_t report, bool isLocal, size_t element, String name, String value) OVERRIDE;
+
private:
RTCStatsResponse();
Vector<RefPtr<RTCStatsReport> > m_result;
Modified: trunk/Source/WebCore/WebCore.gypi (130259 => 130260)
--- trunk/Source/WebCore/WebCore.gypi 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Source/WebCore/WebCore.gypi 2012-10-03 08:01:25 UTC (rev 130260)
@@ -8373,6 +8373,7 @@
'platform/chromium/support/WebRTCSessionDescription.cpp',
'platform/chromium/support/WebRTCSessionDescriptionRequest.cpp',
'platform/chromium/support/WebRTCStatsRequest.cpp',
+ 'platform/chromium/support/WebRTCStatsResponse.cpp',
'platform/chromium/support/WebRTCVoidRequest.cpp',
'platform/chromium/support/WebScrollbarThemeGeometryNative.cpp',
'platform/chromium/support/WebScrollbarThemeGeometryNative.h',
Modified: trunk/Source/WebCore/platform/chromium/support/WebRTCStatsRequest.cpp (130259 => 130260)
--- trunk/Source/WebCore/platform/chromium/support/WebRTCStatsRequest.cpp 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Source/WebCore/platform/chromium/support/WebRTCStatsRequest.cpp 2012-10-03 08:01:25 UTC (rev 130260)
@@ -33,8 +33,10 @@
#if ENABLE(MEDIA_STREAM)
#include <public/WebRTCStatsRequest.h>
+#include <public/WebRTCStatsResponse.h>
#include "RTCStatsRequest.h"
+#include "RTCStatsResponse.h"
#include <wtf/PassOwnPtr.h>
using namespace WebCore;
@@ -56,11 +58,16 @@
m_private.reset();
}
-void WebRTCStatsRequest::requestSucceeded() const
+WebRTCStatsResponse WebRTCStatsRequest::createResponse() const
{
- m_private->requestSucceeded();
+ return WebRTCStatsResponse(m_private->createResponse());
}
+void WebRTCStatsRequest::requestSucceeded(const WebRTCStatsResponse& response) const
+{
+ m_private->requestSucceeded(response);
+}
+
} // namespace WebKit
#endif // ENABLE(MEDIA_STREAM)
Copied: trunk/Source/WebCore/platform/chromium/support/WebRTCStatsResponse.cpp (from rev 130259, trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.cpp) (0 => 130260)
--- trunk/Source/WebCore/platform/chromium/support/WebRTCStatsResponse.cpp (rev 0)
+++ trunk/Source/WebCore/platform/chromium/support/WebRTCStatsResponse.cpp 2012-10-03 08:01:25 UTC (rev 130260)
@@ -0,0 +1,76 @@
+/*
+ * 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 <public/WebRTCStatsResponse.h>
+
+#include "RTCStatsResponseBase.h"
+#include <wtf/PassOwnPtr.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebRTCStatsResponse::WebRTCStatsResponse(const PassRefPtr<RTCStatsResponseBase>& request)
+ : m_private(request)
+{
+}
+
+void WebRTCStatsResponse::assign(const WebRTCStatsResponse& other)
+{
+ m_private = other.m_private;
+}
+
+void WebRTCStatsResponse::reset()
+{
+ m_private.reset();
+}
+
+WebRTCStatsResponse::operator WTF::PassRefPtr<WebCore::RTCStatsResponseBase>() const
+{
+ return m_private.get();
+}
+
+size_t WebRTCStatsResponse::addReport()
+{
+ return m_private->addReport();
+}
+
+size_t WebRTCStatsResponse::addElement(size_t report, bool isLocal, long timestamp)
+{
+ return m_private->addElement(report, isLocal, timestamp);
+}
+
+void WebRTCStatsResponse::addStatistic(size_t report, bool isLocal, size_t element, WebString name, WebString value)
+{
+ m_private->addStatistic(report, isLocal, element, name, value);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(MEDIA_STREAM)
+
Modified: trunk/Source/WebCore/platform/mediastream/RTCStatsRequest.h (130259 => 130260)
--- trunk/Source/WebCore/platform/mediastream/RTCStatsRequest.h 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Source/WebCore/platform/mediastream/RTCStatsRequest.h 2012-10-03 08:01:25 UTC (rev 130260)
@@ -39,11 +39,14 @@
namespace WebCore {
+class RTCStatsResponseBase;
+
class RTCStatsRequest : public RefCounted<RTCStatsRequest> {
public:
virtual ~RTCStatsRequest() { }
- virtual void requestSucceeded() = 0;
+ virtual PassRefPtr<RTCStatsResponseBase> createResponse() = 0;
+ virtual void requestSucceeded(PassRefPtr<RTCStatsResponseBase>) = 0;
protected:
RTCStatsRequest() { }
Copied: trunk/Source/WebCore/platform/mediastream/RTCStatsResponseBase.h (from rev 130259, trunk/Source/WebCore/Modules/mediastream/RTCStatsElement.h) (0 => 130260)
--- trunk/Source/WebCore/platform/mediastream/RTCStatsResponseBase.h (rev 0)
+++ trunk/Source/WebCore/platform/mediastream/RTCStatsResponseBase.h 2012-10-03 08:01:25 UTC (rev 130260)
@@ -0,0 +1,49 @@
+/*
+ * 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 RTCStatsResponseBase_h
+#define RTCStatsResponseBase_h
+
+#if ENABLE(MEDIA_STREAM)
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class RTCStatsResponseBase : public RefCounted<RTCStatsResponseBase> {
+public:
+ virtual ~RTCStatsResponseBase() { }
+
+ virtual size_t addReport() = 0;
+ virtual size_t addElement(size_t report, bool isLocal, long timestamp) = 0;
+ virtual void addStatistic(size_t report, bool isLocal, size_t element, String name, String value) = 0;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(MEDIA_STREAM)
+
+#endif // RTCStatsResponseBase_h
Modified: trunk/Tools/ChangeLog (130259 => 130260)
--- trunk/Tools/ChangeLog 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Tools/ChangeLog 2012-10-03 08:01:25 UTC (rev 130260)
@@ -1 +1,17 @@
+2012-10-03 Harald Alvestrand <[email protected]>
+
+ Add data passing to the GetStats interface of RTCPeerConnection
+ https://bugs.webkit.org/show_bug.cgi?id=98003
+
+ Reviewed by Adam Barth.
+
+ * DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp:
+ (RTCStatsRequestSucceededTask::RTCStatsRequestSucceededTask):
+ (MockWebRTCPeerConnectionHandler::MockWebRTCPeerConnectionHandler):
+ (MockWebRTCPeerConnectionHandler::addStream):
+ (MockWebRTCPeerConnectionHandler::removeStream):
+ (MockWebRTCPeerConnectionHandler::getStats):
+ * DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h:
+ (MockWebRTCPeerConnectionHandler):
+
== Rolled over to ChangeLog-2012-10-02 ==
Modified: trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp (130259 => 130260)
--- trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp 2012-10-03 08:01:25 UTC (rev 130260)
@@ -39,6 +39,7 @@
#include <public/WebRTCSessionDescription.h>
#include <public/WebRTCSessionDescriptionRequest.h>
#include <public/WebRTCStatsRequest.h>
+#include <public/WebRTCStatsResponse.h>
#include <public/WebRTCVoidRequest.h>
#include <public/WebString.h>
#include <public/WebVector.h>
@@ -83,19 +84,21 @@
class RTCStatsRequestSucceededTask : public MethodTask<MockWebRTCPeerConnectionHandler> {
public:
- RTCStatsRequestSucceededTask(MockWebRTCPeerConnectionHandler* object, const WebKit::WebRTCStatsRequest& request)
+ RTCStatsRequestSucceededTask(MockWebRTCPeerConnectionHandler* object, const WebKit::WebRTCStatsRequest& request, const WebKit::WebRTCStatsResponse& response)
: MethodTask<MockWebRTCPeerConnectionHandler>(object)
, m_request(request)
+ , m_response(response)
{
}
virtual void runIfValid() OVERRIDE
{
- m_request.requestSucceeded();
+ m_request.requestSucceeded(m_response);
}
private:
WebKit::WebRTCStatsRequest m_request;
+ WebKit::WebRTCStatsResponse m_response;
};
class RTCVoidRequestTask : public MethodTask<MockWebRTCPeerConnectionHandler> {
@@ -124,6 +127,7 @@
MockWebRTCPeerConnectionHandler::MockWebRTCPeerConnectionHandler(WebRTCPeerConnectionHandlerClient* client)
: m_client(client)
+ , m_streamCount(0)
{
}
@@ -195,6 +199,7 @@
bool MockWebRTCPeerConnectionHandler::addStream(const WebMediaStreamDescriptor& stream, const WebMediaConstraints&)
{
+ m_streamCount += 1;
m_client->didAddRemoteStream(stream);
m_client->negotiationNeeded();
return true;
@@ -202,16 +207,25 @@
void MockWebRTCPeerConnectionHandler::removeStream(const WebMediaStreamDescriptor& stream)
{
+ m_streamCount -= 1;
m_client->didRemoveRemoteStream(stream);
m_client->negotiationNeeded();
}
void MockWebRTCPeerConnectionHandler::getStats(const WebRTCStatsRequest& request)
{
- postTask(new RTCStatsRequestSucceededTask(this, request));
+ WebRTCStatsResponse response = request.createResponse();
+ for (int i = 0; i < m_streamCount; ++i) {
+ size_t reportIndex = response.addReport();
+ size_t elementIndex = response.addElement(reportIndex, true, 12345);
+ response.addStatistic(reportIndex, true, elementIndex, "type", "audio");
+ reportIndex = response.addReport();
+ elementIndex = response.addElement(reportIndex, true, 12345);
+ response.addStatistic(reportIndex, true, elementIndex, "type", "video");
+ }
+ postTask(new RTCStatsRequestSucceededTask(this, request, response));
}
-
void MockWebRTCPeerConnectionHandler::stop()
{
}
Modified: trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h (130259 => 130260)
--- trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h 2012-10-03 07:56:57 UTC (rev 130259)
+++ trunk/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.h 2012-10-03 08:01:25 UTC (rev 130260)
@@ -72,6 +72,7 @@
TaskList m_taskList;
WebKit::WebRTCSessionDescription m_localDescription;
WebKit::WebRTCSessionDescription m_remoteDescription;
+ int m_streamCount;
};
#endif // ENABLE(MEDIA_STREAM)