<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [GStreamer] Do not use GThreadSafeMainLoopSource to send notifications to the main thread in MediaPlayerPrivateGStreamer"
href="https://bugs.webkit.org/show_bug.cgi?id=150888#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [GStreamer] Do not use GThreadSafeMainLoopSource to send notifications to the main thread in MediaPlayerPrivateGStreamer"
href="https://bugs.webkit.org/show_bug.cgi?id=150888">bug 150888</a>
from <span class="vcard"><a class="email" href="mailto:cgarcia@igalia.com" title="Carlos Garcia Campos <cgarcia@igalia.com>"> <span class="fn">Carlos Garcia Campos</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=150888#c3">comment #3</a>)
<span class="quote">> Comment on <span class=""><a href="attachment.cgi?id=264786&action=diff" name="attach_264786" title="Patch">attachment 264786</a> <a href="attachment.cgi?id=264786&action=edit" title="Patch">[details]</a></span>
> Patch
>
> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=264786&action=review">https://bugs.webkit.org/attachment.cgi?id=264786&action=review</a>
>
> Again, please have Phil review the patch as well.</span >
Sure.
<span class="quote">> > Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h:29
> > +template <typename T>
> > +class MainThreadNotifier {
>
> Neat implementation.</span >
:-)
<span class="quote">> > Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h:46
> > + if (!weakThis)
> > + return;
> > + if (weakThis->removePendingNotitifation(notificationType))
> > + callback();
>
> Can this be a two-liner?</span >
Sure.
<span class="quote">> > if (weakThis && weakThis->removePendingNotification(notificationType))
> > callback();
>
> > Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h:61
> > + bool addPendingNotitifation(T notificationType)
>
> Typo: notitifation.</span >
Oops
<span class="quote">> > Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h:70
> > + bool removePendingNotitifation(T notificationType)
>
> Ditto re: typo.
>
> > Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:615
> > + if (isMainThread())
> > + player->notifyPlayerOfVideo();
> > + else
> > + player->m_notifier.notify(MainThreadNotification::VideoChanged, [player] { player->notifyPlayerOfVideo(); });
>
> This isMainThread() check and the conditional immediate execution could be
> rolled up into the notifier class. Would save some lines.
>
> MainThreadNotifier::notify() would accept a templated functor as the second
> parameter, invoke it immediately if on the main thread, or wrap it in
> std::function<> and dispatch it onto the main thread via RunLoop otherwise.</span >
I thought about that, but decided to do it in callers to avoid the function creation just to invoke a member method. But I'm not sure if creating the function would have any real impact in the end, what do you think?</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>