<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&#64;igalia.com" title="Carlos Garcia Campos &lt;cgarcia&#64;igalia.com&gt;"> <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">&gt; Comment on <span class=""><a href="attachment.cgi?id=264786&amp;action=diff" name="attach_264786" title="Patch">attachment 264786</a> <a href="attachment.cgi?id=264786&amp;action=edit" title="Patch">[details]</a></span>
&gt; Patch
&gt; 
&gt; View in context:
&gt; <a href="https://bugs.webkit.org/attachment.cgi?id=264786&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=264786&amp;action=review</a>
&gt; 
&gt; Again, please have Phil review the patch as well.</span >

Sure.

<span class="quote">&gt; &gt; Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h:29
&gt; &gt; +template &lt;typename T&gt;
&gt; &gt; +class MainThreadNotifier {
&gt; 
&gt; Neat implementation.</span >

:-)

<span class="quote">&gt; &gt; Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h:46
&gt; &gt; +            if (!weakThis)
&gt; &gt; +                return;
&gt; &gt; +            if (weakThis-&gt;removePendingNotitifation(notificationType))
&gt; &gt; +                callback();
&gt; 
&gt; Can this be a two-liner?</span >

Sure.

<span class="quote">&gt; &gt; if (weakThis &amp;&amp; weakThis-&gt;removePendingNotification(notificationType))
&gt; &gt;     callback();
&gt; 
&gt; &gt; Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h:61
&gt; &gt; +    bool addPendingNotitifation(T notificationType)
&gt; 
&gt; Typo: notitifation.</span >

Oops

<span class="quote">&gt; &gt; Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h:70
&gt; &gt; +    bool removePendingNotitifation(T notificationType)
&gt; 
&gt; Ditto re: typo.
&gt; 
&gt; &gt; Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:615
&gt; &gt; +    if (isMainThread())
&gt; &gt; +        player-&gt;notifyPlayerOfVideo();
&gt; &gt; +    else
&gt; &gt; +        player-&gt;m_notifier.notify(MainThreadNotification::VideoChanged, [player] { player-&gt;notifyPlayerOfVideo(); });
&gt; 
&gt; This isMainThread() check and the conditional immediate execution could be
&gt; rolled up into the notifier class. Would save some lines.
&gt; 
&gt; MainThreadNotifier::notify() would accept a templated functor as the second
&gt; parameter, invoke it immediately if on the main thread, or wrap it in
&gt; std::function&lt;&gt; 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>