[Webkit-unassigned] [Bug 16815] Crash with navigator.plugins and navigator.mimeTypes after plugins.refresh

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Feb 25 07:44:19 PST 2008


http://bugs.webkit.org/show_bug.cgi?id=16815





------- Comment #21 from darin at apple.com  2008-02-25 07:44 PDT -------
(In reply to comment #19)
> The const of the string in window.navigator.appVersion came actually from the
> existing code in kjs_navigator.cpp, but I've removed the const now. I'm not
> sure about caching the return value of FrameLoaderClient::userAgent due to the
> dependency of the URL though. But perhaps I misunderstood your suggestion.

I wasn't suggesting you cache the result. My point was that for functions that
return String you can do this:

    const String& result = function();
    otherFunction(result);

Using "const String&" rather than "String".

Some on the Safari team here at Apple have suggested using this idiom as the
default for things like String, AtomicString. In cases where the function
actually returns a reference rather than a String, it avoids a bit of refcount
churn, at the expense of being ever so slightly more vulnerable to object
lifetime problems if the object that returned the string is modified before the
reference is used.


-- 
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list