<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@igalia.com" title="Carlos Garcia Campos <cgarcia@igalia.com>"> <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">> Comment on <span class=""><a href="attachment.cgi?id=251154&action=diff" name="attach_251154" title="Another update">attachment 251154</a> <a href="attachment.cgi?id=251154&action=edit" title="Another update">[details]</a></span>
> Another update
>
> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=251154&action=review">https://bugs.webkit.org/attachment.cgi?id=251154&action=review</a>
>
> Looks good to me, but we should chat briefly about benefits and drawbacks of
> 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">> > Source/WebCore/platform/network/soup/GRefPtrSoup.cpp:24
> > +template <> SoupBuffer* refGPtr(SoupBuffer* ptr)
>
> Nit: Do you mind using 'buffer' here instead of 'ptr'?</span >
Sure, we use ptr in all GRefPtrFoo implementations, though.
<span class="quote">> > Source/WebKit2/NetworkProcess/cache/NetworkCacheDataSoup.cpp:41
> > + : m_buffer(adoptGRef(soup_buffer_new(SOUP_MEMORY_COPY, data, size)))
>
> We should probably discuss whether we want to use the WebKit memory
> allocator.</span >
I'm not sure I get what you mean.
<span class="quote">> > Source/WebKit2/NetworkProcess/cache/NetworkCacheDataSoup.cpp:94
> > + uint8_t* data = static_cast<uint8_t*>(g_malloc(size));
>
> Ditto.</span >
Soup uses g_free unconditionally, so when it takes the memory it needs to be allocated with g_malloc().
<span class="quote">> > Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:101
> > + if (bytesRead == -1) {
> > + asyncData->completionHandler(asyncData->data, -1);
> > + delete asyncData;
> > + return;
> > + }
>
> 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 >
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">> > Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:144
> > + gssize bytesRead;
>
> 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">> > Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:149
> > + bytesRead = g_input_stream_read(m_inputStream.get(), const_cast<char*>(readBuffer->data), bytesToRead, nullptr, nullptr);
>
> Same issue here with GFileError. :(
>
> > Source/WebKit2/NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp:181
> > + if (bytesWritten == -1) {
> > + asyncData->completionHandler(-1);
> > + delete asyncData;
> > + return;
> > + }
>
> 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>