<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Make every port implement MainThreadSharedTimer instead of using global functions"
   href="https://bugs.webkit.org/show_bug.cgi?id=150498#c33">Comment # 33</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Make every port implement MainThreadSharedTimer instead of using global functions"
   href="https://bugs.webkit.org/show_bug.cgi?id=150498">bug 150498</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=150498#c32">comment #32</a>)
<span class="quote">&gt; Comment on <span class=""><a href="attachment.cgi?id=264207&amp;action=diff" name="attach_264207" title="Try to fix win build">attachment 264207</a> <a href="attachment.cgi?id=264207&amp;action=edit" title="Try to fix win build">[details]</a></span>
&gt; Try to fix win build
&gt; 
&gt; View in context:
&gt; <a href="https://bugs.webkit.org/attachment.cgi?id=264207&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=264207&amp;action=review</a>
&gt; 
&gt; &gt; Source/WebCore/platform/MainThreadSharedTimer.h:46
&gt; &gt; +    // FIXME: this should be private, but CF and Windows implementations
&gt; &gt; +    // need to call this from static methods at the moment.
&gt; 
&gt; I wouldn’t bother with this FIXME even though I agree with what it says.
&gt; 
&gt; If we were keeping it: we normally use sentence capitalization so &quot;this&quot;
&gt; would be capitalized, and I don't think &quot;static methods&quot; is the term we'd
&gt; want to use here, since that is a way to refer to static member functions,
&gt; but if these were in fact static member functions then there would be no
&gt; problem. I think we mean &quot;non-member functions&quot;. The fact that those
&gt; functions are also declared with &quot;static&quot; so they get internal linkage is
&gt; not relevant.</span >

Ok, I'll fix the comment then.

<span class="quote">&gt; &gt; Source/WebCore/platform/MainThreadSharedTimer.h:52
&gt; &gt; +    std::function&lt;void()&gt; m_firedFunction { nullptr };
&gt; 
&gt; A std::function will be initialized to null without explicitly specifying
&gt; nullptr. Because of that we can simply omit the { nullptr } here.</span >

Ok.

<span class="quote">&gt; &gt; Source/WebCore/platform/SharedTimer.h:41
&gt; &gt; +    SharedTimer() { }
&gt; 
&gt; This line of code can simply be deleted. It has no effect.</span >

It seems to be needed by derived classes constructor, if I remove it I get a build failure:

../../Source/WebCore/platform/MainThreadSharedTimer.cpp: In constructor 'WebCore::MainThreadSharedTimer::MainThreadSharedTimer()':
../../Source/WebCore/platform/MainThreadSharedTimer.cpp:37:46: error: no matching function for call to 'WebCore::SharedTimer::SharedTimer()'
In file included from ../../Source/WebCore/platform/MainThreadSharedTimer.h:30:0,
                 from ../../Source/WebCore/platform/MainThreadSharedTimer.cpp:27:
../../Source/WebCore/platform/SharedTimer.h:39:14: note: candidate: WebCore::SharedTimer::SharedTimer(const WebCore::SharedTimer&amp;) &lt;deleted&gt;
../../Source/WebCore/platform/SharedTimer.h:39:14: note:   candidate expects 1 argument, 0 provided

I guess I can do SharedTimer() = default; instead, though.

<span class="quote">&gt; &gt; Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp:60
&gt; &gt; +    static PowerObserver* powerObserver;
&gt; &gt; +    if (!powerObserver)
&gt; &gt; +        powerObserver = std::make_unique&lt;PowerObserver&gt;(restartSharedTimer).release();
&gt; 
&gt; Not new code, but someone should return to this, since this is a peculiar
&gt; way to write it. I’d write this:
&gt; 
&gt;     static NeverDestroyed&lt;PowerObserver&gt; powerObserver(restartSharedTimer);</span >

Yes, but I'll leave this for someone who can build mac port :-)

<span class="quote">&gt; &gt; Source/WebCore/workers/WorkerRunLoop.cpp:56
&gt; &gt; +    std::function&lt;void()&gt; m_sharedTimerFunction { nullptr };
&gt; 
&gt; No need for the { nullptr } here since std::function will initialize itself
&gt; to null.</span >

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