<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [SOUP] Add initial implementation of NetworkProcess disk cache"
   href="https://bugs.webkit.org/show_bug.cgi?id=143872#c18">Comment # 18</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [SOUP] Add initial implementation of NetworkProcess disk cache"
   href="https://bugs.webkit.org/show_bug.cgi?id=143872">bug 143872</a>
              from <span class="vcard"><a class="email" href="mailto:mrobinson&#64;webkit.org" title="Martin Robinson &lt;mrobinson&#64;webkit.org&gt;"> <span class="fn">Martin Robinson</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=251543&amp;action=diff" name="attach_251543" title="Updated to use fast malloc/free">attachment 251543</a> <a href="attachment.cgi?id=251543&amp;action=edit" title="Updated to use fast malloc/free">[details]</a></span>
Updated to use fast malloc/free

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

<span class="quote">&gt; Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:129
&gt; +    GRefPtr&lt;SoupBuffer&gt; buffer = adoptGRef(soup_buffer_new(SOUP_MEMORY_TAKE, static_cast&lt;char*&gt;(g_malloc(bufferSize)), bufferSize));</span >

Here it might be better to use fastMalloc as well.

<span class="quote">&gt; Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:142
&gt; +    GRefPtr&lt;SoupBuffer&gt; readBuffer = adoptGRef(soup_buffer_new(SOUP_MEMORY_TAKE, static_cast&lt;char*&gt;(g_malloc(bufferSize)), bufferSize));</span >

Ditto.

<span class="quote">&gt; Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:162
&gt; +    size_t bytesToRead = bufferSize;
&gt; +    do {
&gt; +        // FIXME: implement offset.
&gt; +        gssize bytesRead = g_input_stream_read(m_inputStream.get(), const_cast&lt;char*&gt;(readBuffer-&gt;data), bytesToRead, nullptr, nullptr);
&gt; +        if (bytesRead == -1) {
&gt; +            completionHandler(data, -1);
&gt; +            return;
&gt; +        }
&gt; +
&gt; +        if (!bytesRead)
&gt; +            break;
&gt; +
&gt; +        ASSERT(bytesRead &gt; 0);
&gt; +        fillDataFromReadBuffer(readBuffer.get(), static_cast&lt;size_t&gt;(bytesRead), data);
&gt; +
&gt; +        pendingBytesToRead = size - data.size();
&gt; +        bytesToRead = std::min(pendingBytesToRead, readBuffer-&gt;length);
&gt; +    } while (pendingBytesToRead);</span >

Sorry I missed this in the first review. I have a quick question about the synchronous read case. Why is it better to read chunks of data and constantly fill up small buffers? Why not create a buffer the full size of the data and only create a single Data object? Couldn't you avoid all of the concatenation that way?

Otherwise, I suggest a small rename here for the sake of clarity: pendingBytesToRead -&gt; bytesToRead, bytesToRead -&gt; bytesToReadForCurrentChunk.</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>