<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#c13">Comment # 13</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: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=143872#c12">comment #12</a>)
<span class="quote">&gt; 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>
&gt; Another update
&gt; 
&gt; View in context:
&gt; <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>
&gt; 
&gt; Looks good to me, but we should chat briefly about benefits and drawbacks of
&gt; using WebKit's builtin memory manager.</span >

Please note that this is a first implementation of a feature that is disabled, it's a first step to continue working on it.

<span class="quote">&gt; &gt; Source/WebCore/platform/network/soup/GRefPtrSoup.cpp:24
&gt; &gt; +template &lt;&gt; SoupBuffer* refGPtr(SoupBuffer* ptr)
&gt; 
&gt; Nit: Do you mind using 'buffer' here instead of 'ptr'?</span >

Sure, we use ptr in all GRefPtrFoo implementations, though.

<span class="quote">&gt; &gt; Source/WebKit2/NetworkProcess/cache/NetworkCacheDataSoup.cpp:41
&gt; &gt; +    : m_buffer(adoptGRef(soup_buffer_new(SOUP_MEMORY_COPY, data, size)))
&gt; 
&gt; We should probably discuss whether we want to use the WebKit memory
&gt; allocator.</span >

I'm not sure I get what you mean.

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

Soup uses g_free unconditionally, so when it takes the memory it needs to be allocated with g_malloc(). 

<span class="quote">&gt; &gt; Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:101
&gt; &gt; +    if (bytesRead == -1) {
&gt; &gt; +        asyncData-&gt;completionHandler(asyncData-&gt;data, -1);
&gt; &gt; +        delete asyncData;
&gt; &gt; +        return;
&gt; &gt; +    }
&gt; 
&gt; It is annoying that GFileError cannot be used here for the error code,
&gt; because the enum starts at zero. Perhaps a comment here about that could be
&gt; informative.</span >

It can be used, but I didn't care about that yet, I don't even know if those errors are actually handled, or just used to check whether it failed or not.

<span class="quote">&gt; &gt; Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:144
&gt; &gt; +    gssize bytesRead;
&gt; 
&gt; This can move into the do-while loop, I think.</span >

Yes, I think the first impl used that in the while comparison.

<span class="quote">&gt; &gt; Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:149
&gt; &gt; +        bytesRead = g_input_stream_read(m_inputStream.get(), const_cast&lt;char*&gt;(readBuffer-&gt;data), bytesToRead, nullptr, nullptr);
&gt; 
&gt; Same issue here with GFileError. :(
&gt; 
&gt; &gt; Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:181
&gt; &gt; +    if (bytesWritten == -1) {
&gt; &gt; +        asyncData-&gt;completionHandler(-1);
&gt; &gt; +        delete asyncData;
&gt; &gt; +        return;
&gt; &gt; +    }
&gt; 
&gt; Ditto.</span ></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>