Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Implement the GetStats interface on PeerConnection
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. Canonical link: https://commits.webkit.org/115670@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129654 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
529e347
commit 92db9031d0ae9771ca3ccf2f51d52298a41b8a23
Showing
35 changed files
with
1,080 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.