haikuwebkit/LayoutTests/webrtc/libwebrtc/release-while-creating-offe...

29 lines
809 B
HTML
Raw Permalink Normal View History

[WebRTC] LibWebRTCEndpoint should not own objects that should be destroyed on the main thread https://bugs.webkit.org/show_bug.cgi?id=167816 Patch by Youenn Fablet <youennf@gmail.com> on 2017-02-07 Reviewed by Alex Christensen. Source/WebCore: Tests: webrtc/libwebrtc/release-while-creating-offer.html webrtc/libwebrtc/release-while-getting-stats.html webrtc/libwebrtc/release-while-setting-local-description.html Moving AV sources, stats promises, ICE candidates from LibWebRTCEndpoint to LibWebRTCPeerConnectionBackend. This allows ensuring these are destroyed in the main thread. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::getStats): * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::getStats): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::doCreateOffer): (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer): (WebCore::LibWebRTCMediaEndpoint::getStats): (WebCore::LibWebRTCMediaEndpoint::StatsCollector::StatsCollector): (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: (WebCore::LibWebRTCMediaEndpoint::addIceCandidate): (WebCore::LibWebRTCMediaEndpoint::isStopped): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::~LibWebRTCPeerConnectionBackend): (WebCore::LibWebRTCPeerConnectionBackend::getStats): (WebCore::LibWebRTCPeerConnectionBackend::iceCandidateSucceeded): (WebCore::LibWebRTCPeerConnectionBackend::iceCandidateFailed): (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription): (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription): (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate): (WebCore::LibWebRTCPeerConnectionBackend::addAudioSource): (WebCore::LibWebRTCPeerConnectionBackend::addVideoSource): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * testing/MockLibWebRTCPeerConnection.cpp: (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileCreatingOffer::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileCreatingOffer): (WebCore::releaseInNetworkThread): (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileCreatingOffer::CreateOffer): (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileGettingStats::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileGettingStats): (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileGettingStats::GetStats): (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileSettingDescription::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileSettingDescription): (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileSettingDescription::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): * testing/MockLibWebRTCPeerConnection.h: LayoutTests: * webrtc/libwebrtc/release-while-creating-offer.html: Added. * webrtc/libwebrtc/release-while-getting-stats.html: Added. * webrtc/libwebrtc/release-while-setting-local-description.html: Added. Canonical link: https://commits.webkit.org/184986@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-07 21:56:42 +00:00
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script src="../../resources/js-test-pre.js"></script>
<script>
self.jsTestIsAsync = true;
if (window.internals)
internals.useMockRTCPeerConnectionFactory("LibWebRTCReleasingWhileCreatingOffer");
(function() {
var pc = new RTCPeerConnection();
pc.addIceCandidate({ candidate : "2013266431 1 udp 2013266432 192.168.0.100 38838 typ host generation 0", sdpMid: "0", sdpMLineIndex: 0 });
[WebRTC] LibWebRTCEndpoint should not own objects that should be destroyed on the main thread https://bugs.webkit.org/show_bug.cgi?id=167816 Patch by Youenn Fablet <youennf@gmail.com> on 2017-02-07 Reviewed by Alex Christensen. Source/WebCore: Tests: webrtc/libwebrtc/release-while-creating-offer.html webrtc/libwebrtc/release-while-getting-stats.html webrtc/libwebrtc/release-while-setting-local-description.html Moving AV sources, stats promises, ICE candidates from LibWebRTCEndpoint to LibWebRTCPeerConnectionBackend. This allows ensuring these are destroyed in the main thread. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::getStats): * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/PeerConnectionBackend.h: * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::getStats): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::doCreateOffer): (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer): (WebCore::LibWebRTCMediaEndpoint::getStats): (WebCore::LibWebRTCMediaEndpoint::StatsCollector::StatsCollector): (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: (WebCore::LibWebRTCMediaEndpoint::addIceCandidate): (WebCore::LibWebRTCMediaEndpoint::isStopped): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::LibWebRTCPeerConnectionBackend::~LibWebRTCPeerConnectionBackend): (WebCore::LibWebRTCPeerConnectionBackend::getStats): (WebCore::LibWebRTCPeerConnectionBackend::iceCandidateSucceeded): (WebCore::LibWebRTCPeerConnectionBackend::iceCandidateFailed): (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription): (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription): (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate): (WebCore::LibWebRTCPeerConnectionBackend::addAudioSource): (WebCore::LibWebRTCPeerConnectionBackend::addVideoSource): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * testing/MockLibWebRTCPeerConnection.cpp: (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileCreatingOffer::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileCreatingOffer): (WebCore::releaseInNetworkThread): (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileCreatingOffer::CreateOffer): (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileGettingStats::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileGettingStats): (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileGettingStats::GetStats): (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileSettingDescription::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileSettingDescription): (WebCore::MockLibWebRTCPeerConnectionReleasedInNetworkThreadWhileSettingDescription::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): * testing/MockLibWebRTCPeerConnection.h: LayoutTests: * webrtc/libwebrtc/release-while-creating-offer.html: Added. * webrtc/libwebrtc/release-while-getting-stats.html: Added. * webrtc/libwebrtc/release-while-setting-local-description.html: Added. Canonical link: https://commits.webkit.org/184986@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211837 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-07 21:56:42 +00:00
pc.createOffer();
pc.close();
})();
if (window.GCController)
GCController.collect();
setTimeout(finishJSTest, 100);
</script>
<div style="font-family: WebFont;">This test makes sure that RTCPeerConnection will free itself correctly even if released from the network thread.</div>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>