Changeset 244640 in webkit


Ignore:
Timestamp:
Apr 25, 2019 12:47:25 AM (5 years ago)
Author:
Philippe Normand
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.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r244635 r244640  
     12019-04-25  Philippe Normand  <pnormand@igalia.com>
     2
     3        [REGRESSION(r243197)][GStreamer] http/tests/media/clearkey/collect-webkit-media-session.html hits an ASSERT
     4        https://bugs.webkit.org/show_bug.cgi?id=197230
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        Perform the resource loader disposal and destruction from the main
     9        thread. Also ensure there's no circular reference between the
     10        CachedResourceStreamingClient and WebKitWebSrc when disposing of
     11        the private WebKitWebSrc storage.
     12
     13        * platform/graphics/gstreamer/MainThreadNotifier.h:
     14        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
     15        (_WebKitWebSrcPrivate::~_WebKitWebSrcPrivate):
     16        (webkit_web_src_class_init):
     17        (webKitWebSrcDispose):
     18        (webKitWebSrcCloseSession):
     19        (webKitWebSrcFinalize): Deleted.
     20
    1212019-04-24  Carlos Garcia Campos  <cgarcia@igalia.com>
    222
  • trunk/Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h

    r243058 r244640  
    4040        ASSERT(!m_isValid.load());
    4141    }
     42
     43    bool isValid() const { return m_isValid.load(); }
    4244
    4345    template<typename F>
  • trunk/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp

    r244109 r244640  
    4747    const HashSet<RefPtr<WebCore::SecurityOrigin>>& securityOrigins() const { return m_origins; }
    4848
     49    void setSourceElement(WebKitWebSrc* src) { m_src = GST_ELEMENT_CAST(src); }
     50
    4951private:
    5052    void checkUpdateBlocksize(uint64_t bytesRead);
     
    7476    Start = 1 << 0,
    7577    Stop = 1 << 1,
     78    Dispose = 1 << 2,
    7679};
    7780
    7881#define WEBKIT_WEB_SRC_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_SRC, WebKitWebSrcPrivate))
    7982struct _WebKitWebSrcPrivate {
     83    ~_WebKitWebSrcPrivate()
     84    {
     85        if (notifier && notifier->isValid()) {
     86            notifier->notifyAndWait(MainThreadSourceNotification::Dispose, [&] {
     87                if (resource) {
     88                    auto* client = static_cast<CachedResourceStreamingClient*>(resource->client());
     89                    if (client)
     90                        client->setSourceElement(nullptr);
     91
     92                    resource->setClient(nullptr);
     93                }
     94                loader = nullptr;
     95            });
     96            notifier->invalidate();
     97            notifier = nullptr;
     98        }
     99    }
     100
    80101    CString originalURI;
    81102    CString redirectedURI;
     
    132153
    133154static void webKitWebSrcDispose(GObject*);
    134 static void webKitWebSrcFinalize(GObject*);
    135155static void webKitWebSrcSetProperty(GObject*, guint propertyID, const GValue*, GParamSpec*);
    136156static void webKitWebSrcGetProperty(GObject*, guint propertyID, GValue*, GParamSpec*);
     
    159179
    160180    oklass->dispose = webKitWebSrcDispose;
    161     oklass->finalize = webKitWebSrcFinalize;
    162181    oklass->set_property = webKitWebSrcSetProperty;
    163182    oklass->get_property = webKitWebSrcGetProperty;
     
    246265{
    247266    WebKitWebSrcPrivate* priv = WEBKIT_WEB_SRC(object)->priv;
    248     if (priv->notifier) {
    249         priv->notifier->invalidate();
    250         priv->notifier = nullptr;
    251     }
     267
     268    priv->~WebKitWebSrcPrivate();
    252269
    253270    GST_CALL_PARENT(G_OBJECT_CLASS, dispose, (object));
    254 }
    255 
    256 static void webKitWebSrcFinalize(GObject* object)
    257 {
    258     WebKitWebSrcPrivate* priv = WEBKIT_WEB_SRC(object)->priv;
    259 
    260     priv->~WebKitWebSrcPrivate();
    261 
    262     GST_CALL_PARENT(G_OBJECT_CLASS, finalize, (object));
    263271}
    264272
Note: See TracChangeset for help on using the changeset viewer.