[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 03:02:21 PST 2015


https://bugs.webkit.org/show_bug.cgi?id=150888

--- Comment #3 from Zan Dobersek <zan at falconsigh.net> ---
Comment on attachment 264786
  --> https://bugs.webkit.org/attachment.cgi?id=264786
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=264786&action=review

Again, please have Phil review the patch as well.

> 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?

> if (weakThis && weakThis->removePendingNotification(notificationType))
>     callback();

> Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h:61
> +    bool addPendingNotitifation(T notificationType)

Typo: notitifation.

> 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.

-- 
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/bdadd4d7/attachment.html>


More information about the webkit-unassigned mailing list