[Webkit-unassigned] [Bug 32151] New: String::append(const String& str) check whether str.length() != 0

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Dec 4 05:08:45 PST 2009


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

           Summary: String::append(const String& str) check whether
                    str.length() != 0
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Enhancement
          Priority: P2
         Component: WebCore Misc.
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: zherczeg at inf.u-szeged.hu


In CachedScript.cpp:

const String& CachedScript::script()
{
    ASSERT(!isPurgeable());

    if (!m_script && m_data) {
        m_script = m_decoder->decode(m_data->data(), encodedSize());
        m_script += m_decoder->flush();
        setDecodedSize(m_script.length() * sizeof(UChar));
    }

    m_decodedDataDeletionTimer.startOneShot(0);
    return m_script;
}

m_decoder->flush() usually returns with an empty string. However, the append
duplicates the original string even in this case. (The script can be half mbyte
or more). This is an unnecessary allocation and copy.

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



More information about the webkit-unassigned mailing list