Title: [244640] trunk/Source/WebCore
Revision
244640
Author
[email protected]
Date
2019-04-25 00:47:25 -0700 (Thu, 25 Apr 2019)

Log Message

[REGRESSION(r243197)][GStreamer] http/tests/media/clearkey/collect-webkit-media-session.html hits an ASSERT
https://bugs.webkit.org/show_bug.cgi?id=197230

Reviewed by Xabier Rodriguez-Calvar.

Perform the resource loader disposal and destruction from the main
thread. Also ensure there's no circular reference between the
CachedResourceStreamingClient and WebKitWebSrc when disposing of
the private WebKitWebSrc storage.

* platform/graphics/gstreamer/MainThreadNotifier.h:
* platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
(_WebKitWebSrcPrivate::~_WebKitWebSrcPrivate):
(webkit_web_src_class_init):
(webKitWebSrcDispose):
(webKitWebSrcCloseSession):
(webKitWebSrcFinalize): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (244639 => 244640)


--- trunk/Source/WebCore/ChangeLog	2019-04-25 06:42:40 UTC (rev 244639)
+++ trunk/Source/WebCore/ChangeLog	2019-04-25 07:47:25 UTC (rev 244640)
@@ -1,3 +1,23 @@
+2019-04-25  Philippe Normand  <[email protected]>
+
+        [REGRESSION(r243197)][GStreamer] http/tests/media/clearkey/collect-webkit-media-session.html hits an ASSERT
+        https://bugs.webkit.org/show_bug.cgi?id=197230
+
+        Reviewed by Xabier Rodriguez-Calvar.
+
+        Perform the resource loader disposal and destruction from the main
+        thread. Also ensure there's no circular reference between the
+        CachedResourceStreamingClient and WebKitWebSrc when disposing of
+        the private WebKitWebSrc storage.
+
+        * platform/graphics/gstreamer/MainThreadNotifier.h:
+        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
+        (_WebKitWebSrcPrivate::~_WebKitWebSrcPrivate):
+        (webkit_web_src_class_init):
+        (webKitWebSrcDispose):
+        (webKitWebSrcCloseSession):
+        (webKitWebSrcFinalize): Deleted.
+
 2019-04-24  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Hardcoded text color in input fields

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h (244639 => 244640)


--- trunk/Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h	2019-04-25 06:42:40 UTC (rev 244639)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h	2019-04-25 07:47:25 UTC (rev 244640)
@@ -40,6 +40,8 @@
         ASSERT(!m_isValid.load());
     }
 
+    bool isValid() const { return m_isValid.load(); }
+
     template<typename F>
     void notify(T notificationType, F&& callbackFunctor)
     {

Modified: trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp (244639 => 244640)


--- trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp	2019-04-25 06:42:40 UTC (rev 244639)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp	2019-04-25 07:47:25 UTC (rev 244640)
@@ -46,6 +46,8 @@
 
     const HashSet<RefPtr<WebCore::SecurityOrigin>>& securityOrigins() const { return m_origins; }
 
+    void setSourceElement(WebKitWebSrc* src) { m_src = GST_ELEMENT_CAST(src); }
+
 private:
     void checkUpdateBlocksize(uint64_t bytesRead);
 
@@ -73,10 +75,29 @@
 enum MainThreadSourceNotification {
     Start = 1 << 0,
     Stop = 1 << 1,
+    Dispose = 1 << 2,
 };
 
 #define WEBKIT_WEB_SRC_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_SRC, WebKitWebSrcPrivate))
 struct _WebKitWebSrcPrivate {
+    ~_WebKitWebSrcPrivate()
+    {
+        if (notifier && notifier->isValid()) {
+            notifier->notifyAndWait(MainThreadSourceNotification::Dispose, [&] {
+                if (resource) {
+                    auto* client = static_cast<CachedResourceStreamingClient*>(resource->client());
+                    if (client)
+                        client->setSourceElement(nullptr);
+
+                    resource->setClient(nullptr);
+                }
+                loader = nullptr;
+            });
+            notifier->invalidate();
+            notifier = nullptr;
+        }
+    }
+
     CString originalURI;
     CString redirectedURI;
     bool keepAlive;
@@ -131,7 +152,6 @@
 static void webKitWebSrcUriHandlerInit(gpointer gIface, gpointer ifaceData);
 
 static void webKitWebSrcDispose(GObject*);
-static void webKitWebSrcFinalize(GObject*);
 static void webKitWebSrcSetProperty(GObject*, guint propertyID, const GValue*, GParamSpec*);
 static void webKitWebSrcGetProperty(GObject*, guint propertyID, GValue*, GParamSpec*);
 static GstStateChangeReturn webKitWebSrcChangeState(GstElement*, GstStateChange);
@@ -158,7 +178,6 @@
     GObjectClass* oklass = G_OBJECT_CLASS(klass);
 
     oklass->dispose = webKitWebSrcDispose;
-    oklass->finalize = webKitWebSrcFinalize;
     oklass->set_property = webKitWebSrcSetProperty;
     oklass->get_property = webKitWebSrcGetProperty;
 
@@ -245,21 +264,10 @@
 static void webKitWebSrcDispose(GObject* object)
 {
     WebKitWebSrcPrivate* priv = WEBKIT_WEB_SRC(object)->priv;
-    if (priv->notifier) {
-        priv->notifier->invalidate();
-        priv->notifier = nullptr;
-    }
 
-    GST_CALL_PARENT(G_OBJECT_CLASS, dispose, (object));
-}
-
-static void webKitWebSrcFinalize(GObject* object)
-{
-    WebKitWebSrcPrivate* priv = WEBKIT_WEB_SRC(object)->priv;
-
     priv->~WebKitWebSrcPrivate();
 
-    GST_CALL_PARENT(G_OBJECT_CLASS, finalize, (object));
+    GST_CALL_PARENT(G_OBJECT_CLASS, dispose, (object));
 }
 
 static void webKitWebSrcSetProperty(GObject* object, guint propID, const GValue* value, GParamSpec* pspec)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to