<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#c12">Comment # 12</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=251154&amp;action=diff" name="attach_251154" title="Another update">attachment 251154</a> <a href="attachment.cgi?id=251154&amp;action=edit" title="Another update">[details]</a></span>
Another update

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

Looks good to me, but we should chat briefly about benefits and drawbacks of using WebKit's builtin memory manager.

<span class="quote">&gt; Source/WebCore/platform/network/soup/GRefPtrSoup.cpp:24
&gt; +template &lt;&gt; SoupBuffer* refGPtr(SoupBuffer* ptr)</span >

Nit: Do you mind using 'buffer' here instead of 'ptr'?

<span class="quote">&gt; Source/WebKit2/NetworkProcess/cache/NetworkCacheDataSoup.cpp:41
&gt; +    : m_buffer(adoptGRef(soup_buffer_new(SOUP_MEMORY_COPY, data, size)))</span >

We should probably discuss whether we want to use the WebKit memory allocator.

<span class="quote">&gt; Source/WebKit2/NetworkProcess/cache/NetworkCacheDataSoup.cpp:94
&gt; +    uint8_t* data = static_cast&lt;uint8_t*&gt;(g_malloc(size));</span >

Ditto.

<span class="quote">&gt; Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:101
&gt; +    if (bytesRead == -1) {
&gt; +        asyncData-&gt;completionHandler(asyncData-&gt;data, -1);
&gt; +        delete asyncData;
&gt; +        return;
&gt; +    }</span >

It is annoying that GFileError cannot be used here for the error code, because the enum starts at zero. Perhaps a comment here about that could be informative.

<span class="quote">&gt; Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:144
&gt; +    gssize bytesRead;</span >

This can move into the do-while loop, I think.

<span class="quote">&gt; Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:149
&gt; +        bytesRead = g_input_stream_read(m_inputStream.get(), const_cast&lt;char*&gt;(readBuffer-&gt;data), bytesToRead, nullptr, nullptr);</span >

Same issue here with GFileError. :(

<span class="quote">&gt; Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:181
&gt; +    if (bytesWritten == -1) {
&gt; +        asyncData-&gt;completionHandler(-1);
&gt; +        delete asyncData;
&gt; +        return;
&gt; +    }</span >

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