[Webkit-unassigned] [Bug 143872] [SOUP] Add initial implementation of NetworkProcess disk cache

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Apr 24 07:34:29 PDT 2015


https://bugs.webkit.org/show_bug.cgi?id=143872

--- Comment #18 from Martin Robinson <mrobinson at webkit.org> ---
Comment on attachment 251543
  --> https://bugs.webkit.org/attachment.cgi?id=251543
Updated to use fast malloc/free

View in context: https://bugs.webkit.org/attachment.cgi?id=251543&action=review

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

Here it might be better to use fastMalloc as well.

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

Ditto.

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

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 -> bytesToRead, bytesToRead -> bytesToReadForCurrentChunk.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150424/908e3e19/attachment.html>


More information about the webkit-unassigned mailing list