[Webkit-unassigned] [Bug 150888] [GStreamer] Do not use GThreadSafeMainLoopSource to send notifications to the main thread in MediaPlayerPrivateGStreamer
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Nov 5 04:19:47 PST 2015
https://bugs.webkit.org/show_bug.cgi?id=150888
--- Comment #4 from Carlos Garcia Campos <cgarcia at igalia.com> ---
(In reply to comment #3)
> Comment on attachment 264786 [details]
> Patch
>
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=264786&action=review
>
> Again, please have Phil review the patch as well.
Sure.
> > Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h:29
> > +template <typename T>
> > +class MainThreadNotifier {
>
> Neat implementation.
:-)
> > Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h:46
> > + if (!weakThis)
> > + return;
> > + if (weakThis->removePendingNotitifation(notificationType))
> > + callback();
>
> Can this be a two-liner?
Sure.
> > if (weakThis && weakThis->removePendingNotification(notificationType))
> > callback();
>
> > Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h:61
> > + bool addPendingNotitifation(T notificationType)
>
> Typo: notitifation.
Oops
> > 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.
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?
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20151105/08967c19/attachment-0001.html>
More information about the webkit-unassigned
mailing list