- Revision
- 211372
- Author
- carlo...@webkit.org
- Date
- 2017-01-30 10:13:11 -0800 (Mon, 30 Jan 2017)
Log Message
REGRESSION(r202615?): [GStreamer] ASSERTION FAILED: isMainThread() in WebCore::BuiltinResourceHandleConstructorMap& WebCore::builtinResourceHandleConstructorMap()
https://bugs.webkit.org/show_bug.cgi?id=167003
Reviewed by Michael Catanzaro.
Add a way to create a ResourceHandle for a given SoupNetworkSession and use it in the GStreamer streaming client
to ensure both the session and the handle are created and destroyed in the secondary thread. This way we also
avoid using the default session for downloading HLS fragments.
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(ResourceHandleStreamingClient::ResourceHandleStreamingClient): Create a SoupNetworkSession and pass it to ResourceHandle::create().
* platform/network/ResourceHandle.h: Add create and constructor to receive a SoupNetworkSession.
* platform/network/ResourceHandleInternal.h: Add SoupNetworkSession member.
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::ResourceHandleInternal::soupSession): Return the SoupNetworkSession if not nullptr.
(WebCore::ResourceHandle::create): Create a ResourceHandle without trying to use any builtin constructor and
using the given SoupNetworkSession.
(WebCore::ResourceHandle::ResourceHandle): Set the SoupNetworkSession if early request validations didn't fail.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (211371 => 211372)
--- trunk/Source/WebCore/ChangeLog 2017-01-30 17:36:43 UTC (rev 211371)
+++ trunk/Source/WebCore/ChangeLog 2017-01-30 18:13:11 UTC (rev 211372)
@@ -1,3 +1,24 @@
+2017-01-30 Carlos Garcia Campos <cgar...@igalia.com>
+
+ REGRESSION(r202615?): [GStreamer] ASSERTION FAILED: isMainThread() in WebCore::BuiltinResourceHandleConstructorMap& WebCore::builtinResourceHandleConstructorMap()
+ https://bugs.webkit.org/show_bug.cgi?id=167003
+
+ Reviewed by Michael Catanzaro.
+
+ Add a way to create a ResourceHandle for a given SoupNetworkSession and use it in the GStreamer streaming client
+ to ensure both the session and the handle are created and destroyed in the secondary thread. This way we also
+ avoid using the default session for downloading HLS fragments.
+
+ * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+ (ResourceHandleStreamingClient::ResourceHandleStreamingClient): Create a SoupNetworkSession and pass it to ResourceHandle::create().
+ * platform/network/ResourceHandle.h: Add create and constructor to receive a SoupNetworkSession.
+ * platform/network/ResourceHandleInternal.h: Add SoupNetworkSession member.
+ * platform/network/soup/ResourceHandleSoup.cpp:
+ (WebCore::ResourceHandleInternal::soupSession): Return the SoupNetworkSession if not nullptr.
+ (WebCore::ResourceHandle::create): Create a ResourceHandle without trying to use any builtin constructor and
+ using the given SoupNetworkSession.
+ (WebCore::ResourceHandle::ResourceHandle): Set the SoupNetworkSession if early request validations didn't fail.
+
2017-01-30 Youenn Fablet <youe...@gmail.com>
[WebRTC] Add support for libwebrtc data channel
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp (211371 => 211372)
--- trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp 2017-01-30 17:36:43 UTC (rev 211371)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp 2017-01-30 18:13:11 UTC (rev 211372)
@@ -46,6 +46,10 @@
#include <wtf/glib/GUniquePtr.h>
#include <wtf/text/CString.h>
+#if USE(SOUP)
+#include "SoupNetworkSession.h"
+#endif
+
using namespace WebCore;
class StreamingClient {
@@ -111,6 +115,9 @@
Lock m_terminateRunLoopConditionMutex;
Condition m_terminateRunLoopCondition;
RefPtr<ResourceHandle> m_resource;
+#if USE(SOUP)
+ std::unique_ptr<SoupNetworkSession> m_session;
+#endif
};
enum MainThreadSourceNotification {
@@ -1071,7 +1078,13 @@
{
LockHolder locker(m_initializeRunLoopConditionMutex);
m_runLoop = &RunLoop::current();
+#if USE(SOUP)
+ m_session = std::make_unique<SoupNetworkSession>();
+ m_resource = ResourceHandle::create(*m_session, request, this, true, false);
+#else
+ // FIXME: This create will hit an assert in debug builds. See https://bugs.webkit.org/show_bug.cgi?id=167003.
m_resource = ResourceHandle::create(nullptr /*context*/, request, this, true, false);
+#endif
m_initializeRunLoopCondition.notifyOne();
}
if (!m_resource)
@@ -1085,6 +1098,9 @@
m_resource->clearClient();
m_resource->cancel();
m_resource = nullptr;
+#if USE(SOUP)
+ m_session = nullptr;
+#endif
m_terminateRunLoopCondition.notifyOne();
}
});
Modified: trunk/Source/WebCore/platform/network/ResourceHandle.h (211371 => 211372)
--- trunk/Source/WebCore/platform/network/ResourceHandle.h 2017-01-30 17:36:43 UTC (rev 211371)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.h 2017-01-30 18:13:11 UTC (rev 211372)
@@ -86,6 +86,7 @@
class NetworkLoadTiming;
class ResourceRequest;
class ResourceResponse;
+class SoupNetworkSession;
class SharedBuffer;
class Timer;
@@ -94,6 +95,10 @@
WEBCORE_EXPORT static RefPtr<ResourceHandle> create(NetworkingContext*, const ResourceRequest&, ResourceHandleClient*, bool defersLoading, bool shouldContentSniff);
WEBCORE_EXPORT static void loadResourceSynchronously(NetworkingContext*, const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data);
+#if USE(SOUP)
+ static RefPtr<ResourceHandle> create(SoupNetworkSession&, const ResourceRequest&, ResourceHandleClient*, bool defersLoading, bool shouldContentSniff);
+#endif
+
WEBCORE_EXPORT virtual ~ResourceHandle();
#if PLATFORM(COCOA) || USE(CFURLCONNECTION)
@@ -241,6 +246,10 @@
InvalidURLFailure
};
+#if USE(SOUP)
+ ResourceHandle(SoupNetworkSession&, const ResourceRequest&, ResourceHandleClient*, bool defersLoading, bool shouldContentSniff);
+#endif
+
void platformSetDefersLoading(bool);
void platformContinueSynchronousDidReceiveResponse();
Modified: trunk/Source/WebCore/platform/network/ResourceHandleInternal.h (211371 => 211372)
--- trunk/Source/WebCore/platform/network/ResourceHandleInternal.h 2017-01-30 17:36:43 UTC (rev 211371)
+++ trunk/Source/WebCore/platform/network/ResourceHandleInternal.h 2017-01-30 18:13:11 UTC (rev 211372)
@@ -50,6 +50,7 @@
#if USE(SOUP)
#include "GUniquePtrSoup.h"
+#include "SoupNetworkSession.h"
#include <libsoup/soup.h>
#include <wtf/RunLoop.h>
#include <wtf/glib/GRefPtr.h>
@@ -149,6 +150,7 @@
bool m_addedCacheValidationHeaders { false };
#endif
#if USE(SOUP)
+ SoupNetworkSession* m_session { nullptr };
GRefPtr<SoupMessage> m_soupMessage;
ResourceResponse m_response;
bool m_cancelled { false };
Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (211371 => 211372)
--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2017-01-30 17:36:43 UTC (rev 211371)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp 2017-01-30 18:13:11 UTC (rev 211372)
@@ -91,9 +91,38 @@
SoupSession* ResourceHandleInternal::soupSession()
{
- return sessionFromContext(m_context.get());
+ return m_session ? m_session->soupSession() : sessionFromContext(m_context.get());
}
+RefPtr<ResourceHandle> ResourceHandle::create(SoupNetworkSession& session, const ResourceRequest& request, ResourceHandleClient* client, bool defersLoading, bool shouldContentSniff)
+{
+ auto newHandle = adoptRef(*new ResourceHandle(session, request, client, defersLoading, shouldContentSniff));
+
+ if (newHandle->d->m_scheduledFailureType != NoFailure)
+ return WTFMove(newHandle);
+
+ if (newHandle->start())
+ return WTFMove(newHandle);
+
+ return nullptr;
+}
+
+ResourceHandle::ResourceHandle(SoupNetworkSession& session, const ResourceRequest& request, ResourceHandleClient* client, bool defersLoading, bool shouldContentSniff)
+ : d(std::make_unique<ResourceHandleInternal>(this, nullptr, request, client, defersLoading, shouldContentSniff && shouldContentSniffURL(request.url())))
+{
+ if (!request.url().isValid()) {
+ scheduleFailure(InvalidURLFailure);
+ return;
+ }
+
+ if (!portAllowed(request.url())) {
+ scheduleFailure(BlockedFailure);
+ return;
+ }
+
+ d->m_session = &session;
+}
+
bool ResourceHandle::cancelledOrClientless()
{
if (!client())