⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 136188 in webkit


Ignore:
Timestamp:
Nov 29, 2012, 5:13:33 PM (14 years ago)
Author:
haraken@chromium.org
Message:

Unreviewed, rolling out r135862.
​http://trac.webkit.org/changeset/135862
​https://bugs.webkit.org/show_bug.cgi?id=103367

We've been observing 'Fatal error in
v8::V8::AddMessageListener()' in bots

  • bindings/v8/V8Binding.cpp:

(WebCore::v8NonStringValueToWebCoreString):

  • bindings/v8/V8StringResource.cpp:

(WebCore::int32ToWebCoreStringFast):
(WebCore::int32ToWebCoreString):

  • bindings/v8/V8StringResource.h:

(WebCore::V8StringResource::V8StringResource):
(WebCore::V8StringResource::prepareBase):
(WebCore::V8StringResource::setString):
(V8StringResource):
(WebCore::V8StringResource::toString):
(WebCore::::prepare):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r136187 r136188  
     12012-11-29  Kentaro Hara  <haraken@chromium.org>
     2
     3        Unreviewed, rolling out r135862.
     4        http://trac.webkit.org/changeset/135862
     5        https://bugs.webkit.org/show_bug.cgi?id=103367
     6
     7        We've been observing 'Fatal error in
     8        v8::V8::AddMessageListener()' in bots
     9
     10        * bindings/v8/V8Binding.cpp:
     11        (WebCore::v8NonStringValueToWebCoreString):
     12        * bindings/v8/V8StringResource.cpp:
     13        (WebCore::int32ToWebCoreStringFast):
     14        (WebCore::int32ToWebCoreString):
     15        * bindings/v8/V8StringResource.h:
     16        (WebCore::V8StringResource::V8StringResource):
     17        (WebCore::V8StringResource::prepareBase):
     18        (WebCore::V8StringResource::setString):
     19        (V8StringResource):
     20        (WebCore::V8StringResource::toString):
     21        (WebCore::::prepare):
     22
    1232012-11-29  Pavel Feldman  <pfeldman@chromium.org>
    224
  • trunk/Source/WebCore/bindings/v8/V8Binding.cpp

    r135862 r136188  
    101101    ASSERT(!object->IsString());
    102102    if (object->IsInt32())
    103         return int32ToWebCoreString<String>(object->Int32Value());
     103        return int32ToWebCoreString(object->Int32Value());
    104104
    105105    v8::TryCatch block;
  • trunk/Source/WebCore/bindings/v8/V8StringResource.cpp

    r135862 r136188  
    191191    // Most numbers used are <= 100. Even if they aren't used there's very little cost in using the space.
    192192    const int kLowNumbers = 100;
    193 
    194     // FIXME: Store lowNumbers in V8PerIsolateData so that workers can also use them.
    195193    DEFINE_STATIC_LOCAL(Vector<AtomicString>, lowNumbers, (kLowNumbers + 1));
    196194    String webCoreString;
    … …  
    207205}
    208206
    209 template<> String int32ToWebCoreString<String>(int value)
     207String int32ToWebCoreString(int value)
    210208{
    211209    // If we are on the main thread (this should always true for non-workers), call the faster one.
    … …  
    215213}
    216214
    217 template<> AtomicString int32ToWebCoreString<AtomicString>(int value)
    218 {
    219     return AtomicString(int32ToWebCoreString<String>(value));
    220 }
    221 
    222215} // namespace WebCore
  • trunk/Source/WebCore/bindings/v8/V8StringResource.h

    r135862 r136188  
    143143template <typename StringType>
    144144StringType v8StringToWebCoreString(v8::Handle<v8::String>, ExternalMode);
    145 template <typename StringType>
    146 StringType int32ToWebCoreString(int value);
     145String int32ToWebCoreString(int value);
    147146
    148147// V8StringResource is an adapter class that converts V8 values to Strings
    … …  
    160159        : m_v8Object(object)
    161160        , m_mode(Externalize)
     161        , m_string()
    162162    {
    163163    }
    … …  
    170170    bool prepareBase()
    171171    {
    172         ASSERT(!m_v8Object.IsEmpty());
    173         if (LIKELY(m_v8Object->IsString() || m_v8Object->IsInt32()))
     172        if (m_v8Object.IsEmpty())
    174173            return true;
     174
     175        if (LIKELY(m_v8Object->IsString()))
     176            return true;
     177
     178        if (LIKELY(m_v8Object->IsInt32())) {
     179            setString(int32ToWebCoreString(m_v8Object->Int32Value()));
     180            return true;
     181        }
    175182
    176183        m_mode = DoNotExternalize;
    … …  
    185192    }
    186193
     194    void setString(const String& string)
     195    {
     196        m_string = string;
     197        m_v8Object.Clear(); // To signal that String is ready.
     198    }
     199
    187200    template <class StringType>
    188201    StringType toString()
    189202    {
    190         if (m_v8Object.IsEmpty())
    191             return StringType();
    192         if (m_v8Object->IsInt32())
    193             return int32ToWebCoreString<StringType>(m_v8Object->Int32Value());
    194         ASSERT(m_v8Object->IsString());
    195         return v8StringToWebCoreString<StringType>(m_v8Object.As<v8::String>(), m_mode);
     203        if (LIKELY(!m_v8Object.IsEmpty()))
     204            return v8StringToWebCoreString<StringType>(m_v8Object.As<v8::String>(), m_mode);
     205
     206        return StringType(m_string);
    196207    }
    197208
    198209    v8::Local<v8::Value> m_v8Object;
    199210    ExternalMode m_mode;
     211    String m_string;
    200212};
    201213
    202214template<> inline bool V8StringResource<DefaultMode>::prepare()
    203215{
    204     if (m_v8Object.IsEmpty())
    205         return true;
    206216    return prepareBase();
    207217}
    … …  
    210220{
    211221    if (m_v8Object.IsEmpty() || m_v8Object->IsNull()) {
    212         m_v8Object.Clear();
     222        setString(String());
    213223        return true;
    214224    }
    … …  
    219229{
    220230    if (m_v8Object.IsEmpty() || m_v8Object->IsNull() || m_v8Object->IsUndefined()) {
    221         m_v8Object.Clear();
     231        setString(String());
    222232        return true;
    223233    }
Note: See TracChangeset for help on using the changeset viewer.