<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [GStreamer] Use MainThreadNotifier to send notifications to main thread in WebKitWebSourceGStreamer"
href="https://bugs.webkit.org/show_bug.cgi?id=150890#c3">Comment # 3</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [GStreamer] Use MainThreadNotifier to send notifications to main thread in WebKitWebSourceGStreamer"
href="https://bugs.webkit.org/show_bug.cgi?id=150890">bug 150890</a>
from <span class="vcard"><a class="email" href="mailto:zan@falconsigh.net" title="Zan Dobersek <zan@falconsigh.net>"> <span class="fn">Zan Dobersek</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=264788&action=diff" name="attach_264788" title="Patch">attachment 264788</a> <a href="attachment.cgi?id=264788&action=edit" title="Patch">[details]</a></span>
Patch
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=264788&action=review">https://bugs.webkit.org/attachment.cgi?id=264788&action=review</a>
All the uses of MainThreadNotifier<>::notify() need updating, otherwise looks fine.
<span class="quote">> Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:177
> + // NeedData</span >
I usually write these in the same C-style they're declared in: need_data, enough_data, seek_data.
<span class="quote">> Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:194
> + {
> + WTF::GMutexLocker<GMutex> locker(*GST_OBJECT_GET_LOCK(src));
> + if (!priv->paused)
> + return;
> +
> + if (!isMainThread()) {
> + GRefPtr<WebKitWebSrc> protector(src);
> + priv->notifier.notify(MainThreadSourceNotification::NeedData, [protector] { webKitWebSrcNeedData(protector.get()); });
> + return;
> + }
> + }
> +
> + webKitWebSrcNeedData(src);</span >
Can webKitWebSrcNeedData(), webKitWebSrcEnoughData() and webKitWebSrcSeek() all be rewritten and used with the expectation that the GST_OBJECT_GET_LOCK() is already locked? That way the lock can be held throughout the lambda scope, and there's no need for the isMainThread() check at this level.
<span class="quote">> Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:656
> + if (isMainThread())
> + webKitWebSrcStart(src);
> + else {
> + GRefPtr<WebKitWebSrc> protector(src);
> + priv->notifier.notify(MainThreadSourceNotification::Start, [protector] { webKitWebSrcStart(protector.get()); });
> + }</span >
Similarly, webKitWebSrcStart() and webKitWebSrcStop() could just work with the assumption (or an actual run-time assertion) that the GstObject lock is locked.
<span class="quote">> Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:833
> +static void webKitWebSrcSeek(WebKitWebSrc* src)</span >
If all the above is possible, don't forget to set up the lock here.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>