Changeset 140911 in webkit


Ignore:
Timestamp:
Jan 26, 2013 8:08:41 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[v8] prepare SerializedScriptValue for transition to Latin-1
https://bugs.webkit.org/show_bug.cgi?id=107655

Patch by Dan Carney <dcarney@google.com> on 2013-01-26
Reviewed by Kentaro Hara.

No new tests. Covered by existing tests.

  • bindings/v8/SerializedScriptValue.cpp:
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r140910 r140911  
     12013-01-26  Dan Carney  <dcarney@google.com>
     2
     3        [v8] prepare SerializedScriptValue for transition to Latin-1
     4        https://bugs.webkit.org/show_bug.cgi?id=107655
     5
     6        Reviewed by Kentaro Hara.
     7
     8        No new tests. Covered by existing tests.
     9
     10        * bindings/v8/SerializedScriptValue.cpp:
     11
    1122013-01-26  Justin Schuh  <jschuh@chromium.org>
    213
  • trunk/Source/WebCore/bindings/v8/SerializedScriptValue.cpp

    r140409 r140911  
    316316    void writeOneByteString(v8::Handle<v8::String>& string)
    317317    {
    318         int length = string->Length();
    319         ASSERT(length >= 0);
     318        int stringLength = string->Length();
     319        int utf8Length = string->Utf8Length();
     320        ASSERT(stringLength >= 0 && utf8Length >= 0);
    320321
    321322        append(StringTag);
    322         doWriteUint32(static_cast<uint32_t>(length));
    323         ensureSpace(length);
    324 
    325         string->WriteOneByte(byteAt(m_position), 0, length, v8StringWriteOptions());
    326         m_position += length;
     323        doWriteUint32(static_cast<uint32_t>(utf8Length));
     324        ensureSpace(utf8Length);
     325
     326        // ASCII fast path.
     327        if (stringLength == utf8Length)
     328            string->WriteOneByte(byteAt(m_position), 0, utf8Length, v8StringWriteOptions());
     329        else {
     330            char* buffer = reinterpret_cast<char*>(byteAt(m_position));
     331            string->WriteUtf8(buffer, utf8Length, 0, v8StringWriteOptions());
     332        }
     333        m_position += utf8Length;
    327334    }
    328335
Note: See TracChangeset for help on using the changeset viewer.