<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:darin&#64;apple.com" title="Darin Adler &lt;darin&#64;apple.com&gt;"> <span class="fn">Darin Adler</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - ResourceLoadPriority should be enum class"
   href="https://bugs.webkit.org/show_bug.cgi?id=144326">bug 144326</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Attachment #251943 Flags</td>
           <td>review?
           </td>
           <td>review+
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - ResourceLoadPriority should be enum class"
   href="https://bugs.webkit.org/show_bug.cgi?id=144326#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - ResourceLoadPriority should be enum class"
   href="https://bugs.webkit.org/show_bug.cgi?id=144326">bug 144326</a>
              from <span class="vcard"><a class="email" href="mailto:darin&#64;apple.com" title="Darin Adler &lt;darin&#64;apple.com&gt;"> <span class="fn">Darin Adler</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=251943&amp;action=diff" name="attach_251943" title="patch">attachment 251943</a> <a href="attachment.cgi?id=251943&amp;action=edit" title="patch">[details]</a></span>
patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=251943&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=251943&amp;action=review</a>

<span class="quote">&gt; Source/WebCore/loader/ResourceLoadScheduler.cpp:261
&gt; +    copyValuesToVector(m_hosts, hostsToServe);
&gt; +
&gt; +    for (auto* host : hostsToServe) {</span >

I really wish we had an accessor named copiedValues() that did this so we could write:

    for (auto* host : m_hosts.copiedValues())

<span class="quote">&gt; Source/WebCore/loader/ResourceLoadScheduler.cpp:275
&gt; +        HostInformation::RequestQueue&amp; requestsPending = host-&gt;requestsPending(priority);</span >

auto&amp;?

<span class="quote">&gt; Source/WebCore/loader/ResourceLoadScheduler.cpp:377
&gt; -    for (int priority = ResourceLoadPriorityHighest; priority &gt;= ResourceLoadPriorityLowest; --priority) {  
&gt; -        RequestQueue::iterator end = m_requestsPending[priority].end();
&gt; -        for (RequestQueue::iterator it = m_requestsPending[priority].begin(); it != end; ++it) {
&gt; +    for (auto&amp; requestQueue : m_requestsPending) {</span >

This now goes from lowest to highest priority. But the old code went from highest to lowest. Is that an intentional change? Is it OK?

The fact that this goes in a particular priority order is now much less clear than in the old code. I think this needs a comment, and maybe even an assertion.

<span class="quote">&gt; Source/WebCore/loader/ResourceLoadScheduler.cpp:383
&gt; +        for (auto it = requestQueue.begin(), end = requestQueue.end(); it != end; ++it) {
&gt;              if (*it == resourceLoader) {
&gt; -                m_requestsPending[priority].remove(it);
&gt; +                requestQueue.remove(it);
&gt;                  return;
&gt;              }
&gt;          }</span >

It’s a little strange that we have Vector::find but we don’t have Deque::find, so we have to write out this loop. I suggest a helper function or adding something to Deque. Alternatively, I always wonder when I see a loop like this if maybe we are using the wrong data structure. Perhaps this should be a ListHashSet instead of a Deque?

<span class="quote">&gt; Source/WebCore/loader/ResourceLoadScheduler.h:109
&gt; +        std::array&lt;RequestQueue, static_cast&lt;int&gt;(ResourceLoadPriority::Highest) + 1&gt; m_requestsPending;</span >

Might be nice to have a constant for the number of resource load priorities, so the expression &quot;Highest + 1&quot; would be there instead of here.

<span class="quote">&gt; Source/WebCore/platform/network/ResourceLoadPriority.h:41
&gt; +inline ResourceLoadPriority operator++(ResourceLoadPriority&amp; priority)</span >

The return value should be a reference too, since this is the prefix form.

<span class="quote">&gt; Source/WebCore/platform/network/ResourceLoadPriority.h:47
&gt; +inline ResourceLoadPriority operator--(ResourceLoadPriority&amp; priority)</span >

The return value should be a reference too, since this is the prefix form.

<span class="quote">&gt; Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp:154
&gt;  </span >

Extra blank line.

<span class="quote">&gt; Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in:31
&gt; +        </span >

Stray whitespace on this line that looks like a blank line. Git would tell you to remove it by painting it red.

<span class="quote">&gt; Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp:640
&gt;  void InjectedBundle::dispatchPendingLoadRequests()
&gt;  {
&gt; -    resourceLoadScheduler()-&gt;servePendingRequests();
&gt;  }</span >

Why can’t we remove this entirely? If this is unused it seems we should be removing more. If it is used, then we shouldn’t be removing it.

<span class="quote">&gt; Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp:249
&gt; -void WebResourceLoadScheduler::servePendingRequests(ResourceLoadPriority minimumPriority)
&gt; +void WebResourceLoadScheduler::servePendingRequests(ResourceLoadPriority)
&gt;  {
&gt; -    LOG(NetworkScheduling, &quot;(WebProcess) WebResourceLoadScheduler::servePendingRequests&quot;);
&gt; -    
&gt; -    // The NetworkProcess scheduler is good at making sure loads are serviced until there are no more pending requests.
&gt; -    // If this WebProcess isn't expecting requests to be served then we can ignore messaging the NetworkProcess right now.
&gt; -    if (m_suspendPendingRequestsCount)
&gt; -        return;
&gt; -
&gt; -    WebProcess::singleton().networkConnection()-&gt;connection()-&gt;send(Messages::NetworkConnectionToWebProcess::ServePendingRequests(minimumPriority), 0);
&gt;  }</span >

Same question. Can we remove this entirely?a

<span class="quote">&gt; Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.h:55
&gt; -    virtual void servePendingRequests(WebCore::ResourceLoadPriority minimumPriority = WebCore::ResourceLoadPriorityVeryLow) override;
&gt; +    virtual void servePendingRequests(WebCore::ResourceLoadPriority minimumPriority) override;</span >

Same question. Can we remove this entirely?a</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>