Changeset 122163 in webkit


Ignore:
Timestamp:
Jul 9, 2012 4:07:09 PM (12 years ago)
Author:
rniwa@webkit.org
Message:

Microdata tests are flaky
https://bugs.webkit.org/show_bug.cgi?id=90830

Reviewed by Antti Koivisto.

The bug was caused by SpaceSplitString's not copying on write properly.
Even if there was exactly one owner of the SpaceSplitString, we should still not modify
m_data since m_data is associated with a particular m_keyString in sharedDataMap().

The only situation in which we can safely modify m_data is when m_data's m_keyString is null
meaning that it had been unique'ed. Furthermore, this optimization had not been used for
class lists because class list's refCount is always zero as its ref and deref are forwarded
to the associated Element's ref and deref. This fix re-enables the optimization for class lists.

This behavior change is tested by existing microdata API tests. Without this patch,
some tests such as properties-collection-add-remove-property.html fail on the first run
when several tests were ran in the same WebKit instance.

  • dom/SpaceSplitString.h:

(WebCore::SpaceSplitStringData::isUnique):
(WebCore::SpaceSplitString::ensureUnique):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r122160 r122163  
     12012-07-09  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Microdata tests are flaky
     4        https://bugs.webkit.org/show_bug.cgi?id=90830
     5
     6        Reviewed by Antti Koivisto.
     7
     8        The bug was caused by SpaceSplitString's not copying on write properly.
     9        Even if there was exactly one owner of the SpaceSplitString, we should still not modify
     10        m_data since m_data is associated with a particular m_keyString in sharedDataMap().
     11
     12        The only situation in which we can safely modify m_data is when m_data's m_keyString is null
     13        meaning that it had been unique'ed. Furthermore, this optimization had not been used for
     14        class lists because class list's refCount is always zero as its ref and deref are forwarded
     15        to the associated Element's ref and deref. This fix re-enables the optimization for class lists.
     16
     17        This behavior change is tested by existing microdata API tests. Without this patch,
     18        some tests such as properties-collection-add-remove-property.html fail on the first run
     19        when several tests were ran in the same WebKit instance.
     20
     21        * dom/SpaceSplitString.h:
     22        (WebCore::SpaceSplitStringData::isUnique):
     23        (WebCore::SpaceSplitString::ensureUnique):
     24
    1252012-07-09  Dana Jansens  <danakj@chromium.org>
    226
  • trunk/Source/WebCore/dom/SpaceSplitString.h

    r105186 r122163  
    5050        void remove(const AtomicString&);
    5151
     52        bool isUnique() const { return m_keyString.isNull(); }
    5253        size_t size() const { return m_vector.size(); }
    5354        const AtomicString& operator[](size_t i) { ASSERT(i < size()); return m_vector[i]; }
     
    8384        void ensureUnique()
    8485        {
    85             if (m_data && !m_data->hasOneRef())
     86            if (m_data && !m_data->isUnique())
    8687                m_data = SpaceSplitStringData::createUnique(*m_data);
    8788        }
Note: See TracChangeset for help on using the changeset viewer.