Title: [238642] trunk/Source/WebCore
- Revision
- 238642
- Author
- you...@apple.com
- Date
- 2018-11-28 14:12:32 -0800 (Wed, 28 Nov 2018)
Log Message
imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-transceivers.https.html is flaky on iOS simulator
https://bugs.webkit.org/show_bug.cgi?id=192037
Reviewed by Eric Carlson.
The stats report JS map should be created when resolving the stats promise with WebCore RTCStatsReport.
But resolving the promise might fail in case of a page being suspended.
In that case, no JSRTCStatsReport is created and there is no backing map.
Update the code to reflect that.
Covered by existing test.
* Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
(WebCore::LibWebRTCMediaEndpoint::getStats):
* Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp:
(WebCore::LibWebRTCStatsCollector::~LibWebRTCStatsCollector):
(WebCore::LibWebRTCStatsCollector::OnStatsDelivered):
* Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (238641 => 238642)
--- trunk/Source/WebCore/ChangeLog 2018-11-28 22:12:22 UTC (rev 238641)
+++ trunk/Source/WebCore/ChangeLog 2018-11-28 22:12:32 UTC (rev 238642)
@@ -1,3 +1,23 @@
+2018-11-28 Youenn Fablet <you...@apple.com>
+
+ imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-transceivers.https.html is flaky on iOS simulator
+ https://bugs.webkit.org/show_bug.cgi?id=192037
+
+ Reviewed by Eric Carlson.
+
+ The stats report JS map should be created when resolving the stats promise with WebCore RTCStatsReport.
+ But resolving the promise might fail in case of a page being suspended.
+ In that case, no JSRTCStatsReport is created and there is no backing map.
+ Update the code to reflect that.
+ Covered by existing test.
+
+ * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
+ (WebCore::LibWebRTCMediaEndpoint::getStats):
+ * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp:
+ (WebCore::LibWebRTCStatsCollector::~LibWebRTCStatsCollector):
+ (WebCore::LibWebRTCStatsCollector::OnStatsDelivered):
+ * Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.h:
+
2018-11-28 Keith Rollin <krol...@apple.com>
Update generate-{derived,unified}-sources scripts to support generating .xcfilelist files
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp (238641 => 238642)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2018-11-28 22:12:22 UTC (rev 238641)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp 2018-11-28 22:12:32 UTC (rev 238642)
@@ -285,13 +285,19 @@
void LibWebRTCMediaEndpoint::getStats(Ref<DeferredPromise>&& promise, WTF::Function<void(rtc::scoped_refptr<LibWebRTCStatsCollector>&&)>&& getStatsFunction)
{
- auto collector = LibWebRTCStatsCollector::create([promise = WTFMove(promise), protectedThis = makeRef(*this)](auto&& report) mutable {
+ auto collector = LibWebRTCStatsCollector::create([promise = WTFMove(promise), protectedThis = makeRef(*this)]() mutable -> RefPtr<RTCStatsReport> {
ASSERT(isMainThread());
- if (protectedThis->isStopped() || !report)
- return false;
+ if (protectedThis->isStopped())
+ return nullptr;
- promise->resolve<IDLInterface<RTCStatsReport>>(report.releaseNonNull());
- return true;
+ auto report = RTCStatsReport::create();
+
+ promise->resolve<IDLInterface<RTCStatsReport>>(report.copyRef());
+
+ // The promise resolution might fail in which case no backing map will be created.
+ if (!report->backingMap())
+ return nullptr;
+ return WTFMove(report);
});
LibWebRTCProvider::callOnWebRTCSignalingThread([getStatsFunction = WTFMove(getStatsFunction), collector = WTFMove(collector)]() mutable {
getStatsFunction(WTFMove(collector));
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp (238641 => 238642)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp 2018-11-28 22:12:22 UTC (rev 238641)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.cpp 2018-11-28 22:12:32 UTC (rev 238642)
@@ -44,7 +44,7 @@
return;
callOnMainThread([callback = WTFMove(m_callback)]() mutable {
- callback({ });
+ callback();
});
}
@@ -384,8 +384,8 @@
void LibWebRTCStatsCollector::OnStatsDelivered(const rtc::scoped_refptr<const webrtc::RTCStatsReport>& rtcReport)
{
callOnMainThread([protectedThis = rtc::scoped_refptr<LibWebRTCStatsCollector>(this), rtcReport] {
- auto report = RTCStatsReport::create();
- if (!protectedThis->m_callback(report.copyRef()))
+ auto report = protectedThis->m_callback();
+ if (!report)
return;
ASSERT(report->backingMap());
Modified: trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.h (238641 => 238642)
--- trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.h 2018-11-28 22:12:22 UTC (rev 238641)
+++ trunk/Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCStatsCollector.h 2018-11-28 22:12:32 UTC (rev 238642)
@@ -42,7 +42,7 @@
class LibWebRTCStatsCollector : public webrtc::RTCStatsCollectorCallback {
public:
- using CollectorCallback = WTF::CompletionHandler<bool(RefPtr<RTCStatsReport>&&)>;
+ using CollectorCallback = CompletionHandler<RefPtr<RTCStatsReport>()>;
static rtc::scoped_refptr<LibWebRTCStatsCollector> create(CollectorCallback&& callback) { return new rtc::RefCountedObject<LibWebRTCStatsCollector>(WTFMove(callback)); }
explicit LibWebRTCStatsCollector(CollectorCallback&&);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes