<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:mrobinson@webkit.org" title="Martin Robinson <mrobinson@webkit.org>"> <span class="fn">Martin Robinson</span></a>
</span> changed
<a class="bz_bug_link
bz_status_NEW "
title="NEW - [GTK] Add API to WebKitWebsiteDataManager to handle cached data"
href="https://bugs.webkit.org/show_bug.cgi?id=146589">bug 146589</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>mrobinson@webkit.org
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [GTK] Add API to WebKitWebsiteDataManager to handle cached data"
href="https://bugs.webkit.org/show_bug.cgi?id=146589#c10">Comment # 10</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [GTK] Add API to WebKitWebsiteDataManager to handle cached data"
href="https://bugs.webkit.org/show_bug.cgi?id=146589">bug 146589</a>
from <span class="vcard"><a class="email" href="mailto:mrobinson@webkit.org" title="Martin Robinson <mrobinson@webkit.org>"> <span class="fn">Martin Robinson</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=146589#c9">comment #9</a>)
<span class="quote">> (In reply to <a href="show_bug.cgi?id=146589#c7">comment #7</a>)
> >
> > 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.</span >
Yes, exactly. We have the CString members because the return value of utf8() is a temporary. :)</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>