Commit 53e841a2 authored by abarth@webkit.org's avatar abarth@webkit.org

2009-06-19 Adam Barth <abarth@webkit.org>

        Reviewed by Darin Adler.

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

        Remove a memcpy by retrieving the already existing copy of a string
        instead of making a new one.

        * bindings/js/ScriptSourceCode.h:
        (WebCore::ScriptSourceCode::ScriptSourceCode):
        (WebCore::ScriptSourceCode::source):
        * bindings/js/StringSourceProvider.h:
        (WebCore::StringSourceProvider::source):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44894 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 50d86dbd
2009-06-19 Adam Barth <abarth@webkit.org>
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=26561
Remove a memcpy by retrieving the already existing copy of a string
instead of making a new one.
* bindings/js/ScriptSourceCode.h:
(WebCore::ScriptSourceCode::ScriptSourceCode):
(WebCore::ScriptSourceCode::source):
* bindings/js/StringSourceProvider.h:
(WebCore::StringSourceProvider::source):
2009-06-19 Brian Weinstein <bweinstein@apple.com>
Reviewed by Steve Falkenburg.
......
......@@ -53,8 +53,7 @@ public:
const JSC::SourceCode& jsSourceCode() const { return m_code; }
// Note the memcpy!
String source() const { return String(m_code.data(), m_code.length()); }
const String& source() const { return static_cast<StringSourceProvider*>(m_code.provider())->source(); }
private:
JSC::SourceCode m_code;
......
......@@ -40,6 +40,7 @@ namespace WebCore {
JSC::UString getRange(int start, int end) const { return JSC::UString(m_source.characters() + start, end - start); }
const UChar* data() const { return m_source.characters(); }
int length() const { return m_source.length(); }
const String& source() const { return m_source; }
private:
StringSourceProvider(const String& source, const String& url)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment