[Webkit-unassigned] [Bug 146589] [GTK] Add API to WebKitWebsiteDataManager to handle cached data

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 28 09:19:23 PDT 2015


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

Martin Robinson <mrobinson at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrobinson at webkit.org

--- Comment #10 from Martin Robinson <mrobinson at webkit.org> ---
(In reply to comment #9)
> (In reply to comment #7)
> > 
> > This is a common thing we do in the API just to make it more convenient to
> > use. The host and protocol are stored in WebCore::SecurityOrigin as String,
> > but all our APIs return always string in utf8 (like all other GNOME platform
> > APIs). If we return the converted string directly, the returned value should
> > be freed by the user. So, we cache the converted strings to be able to
> > return a const char *, and we do that only on demand, so if you never call
> > get_host we don't have a cached value for nothing.
> 
> Surely if we were to take a String s and return s.utf8().data(), that does
> not need to be freed by the caller. It is a pointer to the CString's
> internal CStringBuffer. And the CString has a reference-counted
> CStringBuffer, so the data should be freed automatically when... er, when
> the function returns. Ah, OK, so that would be bad. WebKit's strings are
> confusing; I wish it hadn't taken a year for me to realize this.


Yes, exactly. We have the CString members because the return value of utf8() is a temporary. :)

-- 
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/20150728/c8d7c073/attachment.html>


More information about the webkit-unassigned mailing list