- Revision
- 128115
- Author
- [email protected]
- Date
- 2012-09-10 15:18:40 -0700 (Mon, 10 Sep 2012)
Log Message
Unreviewed, rolling out r128109.
http://trac.webkit.org/changeset/128109
https://bugs.webkit.org/show_bug.cgi?id=96326
broke win and lion builds (Requested by kling on #webkit).
Patch by Sheriff Bot <[email protected]> on 2012-09-10
* WebCore.exp.in:
* dom/Element.cpp:
(WebCore::Element::createMutableAttributeData):
* dom/ElementAttributeData.cpp:
(WebCore::immutableElementAttributeDataSize):
(WebCore::ElementAttributeData::createImmutable):
(WebCore::ElementAttributeData::ElementAttributeData):
(WebCore::ElementAttributeData::~ElementAttributeData):
(WebCore::ElementAttributeData::addAttribute):
(WebCore::ElementAttributeData::removeAttribute):
(WebCore::ElementAttributeData::reportMemoryUsage):
(WebCore::ElementAttributeData::cloneDataFrom):
(WebCore::ElementAttributeData::clearAttributes):
* dom/ElementAttributeData.h:
(WebCore):
(WebCore::ElementAttributeData::create):
(ElementAttributeData):
(WebCore::ElementAttributeData::isMutable):
(WebCore::ElementAttributeData::makeMutable):
(WebCore::ElementAttributeData::length):
(WebCore::ElementAttributeData::attributeItem):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (128114 => 128115)
--- trunk/Source/WebCore/ChangeLog 2012-09-10 22:17:08 UTC (rev 128114)
+++ trunk/Source/WebCore/ChangeLog 2012-09-10 22:18:40 UTC (rev 128115)
@@ -1,3 +1,33 @@
+2012-09-10 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r128109.
+ http://trac.webkit.org/changeset/128109
+ https://bugs.webkit.org/show_bug.cgi?id=96326
+
+ broke win and lion builds (Requested by kling on #webkit).
+
+ * WebCore.exp.in:
+ * dom/Element.cpp:
+ (WebCore::Element::createMutableAttributeData):
+ * dom/ElementAttributeData.cpp:
+ (WebCore::immutableElementAttributeDataSize):
+ (WebCore::ElementAttributeData::createImmutable):
+ (WebCore::ElementAttributeData::ElementAttributeData):
+ (WebCore::ElementAttributeData::~ElementAttributeData):
+ (WebCore::ElementAttributeData::addAttribute):
+ (WebCore::ElementAttributeData::removeAttribute):
+ (WebCore::ElementAttributeData::reportMemoryUsage):
+ (WebCore::ElementAttributeData::cloneDataFrom):
+ (WebCore::ElementAttributeData::clearAttributes):
+ * dom/ElementAttributeData.h:
+ (WebCore):
+ (WebCore::ElementAttributeData::create):
+ (ElementAttributeData):
+ (WebCore::ElementAttributeData::isMutable):
+ (WebCore::ElementAttributeData::makeMutable):
+ (WebCore::ElementAttributeData::length):
+ (WebCore::ElementAttributeData::attributeItem):
+
2012-09-10 Chris Fleizach <[email protected]>
AccessibilityNodeObject* is not in Mac xcode file
Modified: trunk/Source/WebCore/WebCore.exp.in (128114 => 128115)
--- trunk/Source/WebCore/WebCore.exp.in 2012-09-10 22:17:08 UTC (rev 128114)
+++ trunk/Source/WebCore/WebCore.exp.in 2012-09-10 22:18:40 UTC (rev 128115)
@@ -230,7 +230,6 @@
__ZN7WebCore13directoryNameERKN3WTF6StringE
__ZN7WebCore13toHTMLElementEPNS_21FormAssociatedElementE
__ZN7WebCore13toJSDOMWindowEN3JSC7JSValueE
-__ZN7WebCore13QualifiedNameD1Ev
__ZN7WebCore14CachedResource12removeClientEPNS_20CachedResourceClientE
__ZN7WebCore14CachedResource16unregisterHandleEPNS_24CachedResourceHandleBaseE
__ZN7WebCore14CachedResource9addClientEPNS_20CachedResourceClientE
@@ -539,7 +538,6 @@
__ZN7WebCore20UserGestureIndicatorD1Ev
__ZN7WebCore20makeRGBA32FromFloatsEffff
__ZN7WebCore20protocolIsJavaScriptERKN3WTF6StringE
-__ZN7WebCore20SpaceSplitStringDataD1Ev
__ZN7WebCore21BackForwardController11itemAtIndexEi
__ZN7WebCore21MemoryPressureHandler7installEv
__ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS_13PlatformEvent4TypeEb
Modified: trunk/Source/WebCore/dom/Element.cpp (128114 => 128115)
--- trunk/Source/WebCore/dom/Element.cpp 2012-09-10 22:17:08 UTC (rev 128114)
+++ trunk/Source/WebCore/dom/Element.cpp 2012-09-10 22:18:40 UTC (rev 128115)
@@ -2246,7 +2246,7 @@
if (!m_attributeData)
m_attributeData = ElementAttributeData::create();
else
- m_attributeData = m_attributeData->makeMutableCopy();
+ m_attributeData = m_attributeData->makeMutable();
}
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/ElementAttributeData.cpp (128114 => 128115)
--- trunk/Source/WebCore/dom/ElementAttributeData.cpp 2012-09-10 22:17:08 UTC (rev 128114)
+++ trunk/Source/WebCore/dom/ElementAttributeData.cpp 2012-09-10 22:18:40 UTC (rev 128115)
@@ -36,56 +36,64 @@
static size_t immutableElementAttributeDataSize(unsigned count)
{
- return sizeof(ImmutableElementAttributeData) + sizeof(Attribute) * count;
+ return sizeof(ElementAttributeData) - sizeof(void*) + sizeof(Attribute) * count;
}
PassRefPtr<ElementAttributeData> ElementAttributeData::createImmutable(const Vector<Attribute>& attributes)
{
void* slot = WTF::fastMalloc(immutableElementAttributeDataSize(attributes.size()));
- return adoptRef(new (slot) ImmutableElementAttributeData(attributes));
+ return adoptRef(new (slot) ElementAttributeData(attributes));
}
-PassRefPtr<ElementAttributeData> ElementAttributeData::create()
+ElementAttributeData::ElementAttributeData()
+ : m_isMutable(true)
+ , m_arraySize(0)
+ , m_mutableAttributeVector(new Vector<Attribute, 4>)
{
- return adoptRef(new MutableElementAttributeData);
}
-ImmutableElementAttributeData::ImmutableElementAttributeData(const Vector<Attribute>& attributes)
- : ElementAttributeData(attributes.size())
+ElementAttributeData::ElementAttributeData(const Vector<Attribute>& attributes)
+ : m_isMutable(false)
+ , m_arraySize(attributes.size())
{
- for (unsigned i = 0; i < m_arraySize; ++i)
- new (&m_attributeArray[i]) Attribute(attributes[i]);
+ Attribute* buffer = reinterpret_cast<Attribute*>(&m_attributes);
+ for (unsigned i = 0; i < attributes.size(); ++i)
+ new (&buffer[i]) Attribute(attributes[i]);
}
-MutableElementAttributeData::MutableElementAttributeData(const ImmutableElementAttributeData& other)
+ElementAttributeData::ElementAttributeData(const ElementAttributeData& other)
+ : RefCounted<ElementAttributeData>()
+ , m_isMutable(true)
+ , m_arraySize(0)
+ , m_inlineStyleDecl(other.m_inlineStyleDecl)
+ , m_attributeStyle(other.m_attributeStyle)
+ , m_classNames(other.m_classNames)
+ , m_idForStyleResolution(other.m_idForStyleResolution)
+ , m_mutableAttributeVector(new Vector<Attribute, 4>)
{
- const ElementAttributeData& baseOther = static_cast<const ElementAttributeData&>(other);
+ // This copy constructor should only be used by makeMutable() to go from immutable to mutable.
+ ASSERT(!other.m_isMutable);
- m_inlineStyleDecl = baseOther.m_inlineStyleDecl;
- m_attributeStyle = baseOther.m_attributeStyle;
- m_classNames = baseOther.m_classNames;
- m_idForStyleResolution = baseOther.m_idForStyleResolution;
+ // An immutable ElementAttributeData should never have a mutable inline StylePropertySet attached.
+ ASSERT(!other.m_inlineStyleDecl || !other.m_inlineStyleDecl->isMutable());
- // An ImmutableElementAttributeData should never have a mutable inline StylePropertySet attached.
- ASSERT(!baseOther.m_inlineStyleDecl || !baseOther.m_inlineStyleDecl->isMutable());
-
- m_attributeVector.reserveCapacity(baseOther.m_arraySize);
- for (unsigned i = 0; i < baseOther.m_arraySize; ++i)
- m_attributeVector.uncheckedAppend(other.m_attributeArray[i]);
+ const Attribute* otherBuffer = reinterpret_cast<const Attribute*>(&other.m_attributes);
+ for (unsigned i = 0; i < other.m_arraySize; ++i)
+ m_mutableAttributeVector->append(otherBuffer[i]);
}
-ImmutableElementAttributeData::~ImmutableElementAttributeData()
+ElementAttributeData::~ElementAttributeData()
{
- for (unsigned i = 0; i < m_arraySize; ++i)
- m_attributeArray[i].~Attribute();
+ if (isMutable()) {
+ ASSERT(!m_arraySize);
+ delete m_mutableAttributeVector;
+ } else {
+ Attribute* buffer = reinterpret_cast<Attribute*>(&m_attributes);
+ for (unsigned i = 0; i < m_arraySize; ++i)
+ buffer[i].~Attribute();
+ }
}
-PassRefPtr<ElementAttributeData> ElementAttributeData::makeMutableCopy() const
-{
- ASSERT(!isMutable());
- return adoptRef(new MutableElementAttributeData(static_cast<const ImmutableElementAttributeData&>(*this)));
-}
-
typedef Vector<RefPtr<Attr> > AttrList;
typedef HashMap<Element*, OwnPtr<AttrList> > AttrListMap;
@@ -228,7 +236,7 @@
if (element && inSynchronizationOfLazyAttribute == NotInSynchronizationOfLazyAttribute)
element->willModifyAttribute(attribute.name(), nullAtom, attribute.value());
- mutableAttributeVector().append(attribute);
+ m_mutableAttributeVector->append(attribute);
if (element && inSynchronizationOfLazyAttribute == NotInSynchronizationOfLazyAttribute)
element->didAddAttribute(attribute);
@@ -239,7 +247,7 @@
ASSERT(isMutable());
ASSERT(index < length());
- Attribute& attribute = mutableAttributeVector().at(index);
+ Attribute& attribute = m_mutableAttributeVector->at(index);
QualifiedName name = attribute.name();
if (element && inSynchronizationOfLazyAttribute == NotInSynchronizationOfLazyAttribute)
@@ -248,7 +256,7 @@
if (RefPtr<Attr> attr = attrIfExists(element, name))
attr->detachFromElementWithValue(attribute.value());
- mutableAttributeVector().remove(index);
+ m_mutableAttributeVector->remove(index);
if (element && inSynchronizationOfLazyAttribute == NotInSynchronizationOfLazyAttribute)
element->didRemoveAttribute(name);
@@ -296,7 +304,7 @@
info.addMember(m_classNames);
info.addInstrumentedMember(m_idForStyleResolution);
if (m_isMutable)
- info.addVector(mutableAttributeVector());
+ info.addVectorPtr(m_mutableAttributeVector);
for (unsigned i = 0, len = length(); i < len; i++)
info.addInstrumentedMember(*attributeItem(i));
}
@@ -340,15 +348,17 @@
clearAttributes(&targetElement);
if (sourceData.isMutable())
- mutableAttributeVector() = sourceData.mutableAttributeVector();
+ *m_mutableAttributeVector = *sourceData.m_mutableAttributeVector;
else {
- mutableAttributeVector().reserveInitialCapacity(sourceData.m_arraySize);
+ ASSERT(m_mutableAttributeVector->isEmpty());
+ m_mutableAttributeVector->reserveInitialCapacity(sourceData.m_arraySize);
+ const Attribute* sourceBuffer = reinterpret_cast<const Attribute*>(&sourceData.m_attributes);
for (unsigned i = 0; i < sourceData.m_arraySize; ++i)
- mutableAttributeVector().uncheckedAppend(sourceData.immutableAttributeArray()[i]);
+ m_mutableAttributeVector->uncheckedAppend(sourceBuffer[i]);
}
for (unsigned i = 0; i < length(); ++i) {
- const Attribute& attribute = mutableAttributeVector().at(i);
+ const Attribute& attribute = m_mutableAttributeVector->at(i);
if (targetElement.isStyledElement() && attribute.name() == HTMLNames::styleAttr) {
static_cast<StyledElement&>(targetElement).styleAttributeChanged(attribute.value(), StyledElement::DoNotReparseStyleAttribute);
continue;
@@ -370,7 +380,7 @@
detachAttrObjectsFromElement(element);
clearClass();
- mutableAttributeVector().clear();
+ m_mutableAttributeVector->clear();
}
PassRefPtr<Attr> ElementAttributeData::getAttributeNode(const String& name, bool shouldIgnoreAttributeCase, Element* element) const
Modified: trunk/Source/WebCore/dom/ElementAttributeData.h (128114 => 128115)
--- trunk/Source/WebCore/dom/ElementAttributeData.h 2012-09-10 22:17:08 UTC (rev 128114)
+++ trunk/Source/WebCore/dom/ElementAttributeData.h 2012-09-10 22:18:40 UTC (rev 128115)
@@ -35,17 +35,16 @@
class Attr;
class Element;
-class ImmutableElementAttributeData;
class MemoryObjectInfo;
-class MutableElementAttributeData;
enum SynchronizationOfLazyAttribute { NotInSynchronizationOfLazyAttribute, InSynchronizationOfLazyAttribute };
class ElementAttributeData : public RefCounted<ElementAttributeData> {
WTF_MAKE_FAST_ALLOCATED;
public:
- static PassRefPtr<ElementAttributeData> create();
+ static PassRefPtr<ElementAttributeData> create() { return adoptRef(new ElementAttributeData); }
static PassRefPtr<ElementAttributeData> createImmutable(const Vector<Attribute>&);
+ ~ElementAttributeData();
void clearClass() { m_classNames.clear(); }
void setClass(const AtomicString& className, bool shouldFoldCase) const { m_classNames.set(className, shouldFoldCase); }
@@ -96,84 +95,41 @@
void reportMemoryUsage(MemoryObjectInfo*) const;
- bool isMutable() const { return m_isMutable; }
-
-protected:
- ElementAttributeData()
- : m_isMutable(true)
- , m_arraySize(0)
- { }
-
- ElementAttributeData(unsigned arraySize)
- : m_isMutable(false)
- , m_arraySize(arraySize)
- { }
-
- mutable RefPtr<StylePropertySet> m_inlineStyleDecl;
- mutable RefPtr<StylePropertySet> m_attributeStyle;
- mutable SpaceSplitString m_classNames;
- mutable AtomicString m_idForStyleResolution;
-
- unsigned m_isMutable : 1;
- unsigned m_arraySize : 31;
-
private:
friend class Element;
friend class HTMLConstructionSite;
- friend class ImmutableElementAttributeData;
- friend class MutableElementAttributeData;
+ ElementAttributeData();
+ ElementAttributeData(const ElementAttributeData&);
+ ElementAttributeData(const Vector<Attribute>&);
+
Attribute* getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase);
const Attribute* getAttributeItem(const AtomicString& name, bool shouldIgnoreAttributeCase) const;
size_t getAttributeItemIndexSlowCase(const AtomicString& name, bool shouldIgnoreAttributeCase) const;
void cloneDataFrom(const ElementAttributeData& sourceData, const Element& sourceElement, Element& targetElement);
void clearAttributes(Element*);
- PassRefPtr<ElementAttributeData> makeMutableCopy() const;
+ bool isMutable() const { return m_isMutable; }
+ PassRefPtr<ElementAttributeData> makeMutable() const { return adoptRef(new ElementAttributeData(*this)); }
- Vector<Attribute, 4>& mutableAttributeVector();
- const Vector<Attribute, 4>& mutableAttributeVector() const;
- const Attribute* immutableAttributeArray() const;
-};
+ unsigned m_isMutable : 1;
+ unsigned m_arraySize : 31;
-class ImmutableElementAttributeData : public ElementAttributeData {
-public:
- ImmutableElementAttributeData(const Vector<Attribute>&);
- ~ImmutableElementAttributeData();
+ mutable RefPtr<StylePropertySet> m_inlineStyleDecl;
+ mutable RefPtr<StylePropertySet> m_attributeStyle;
+ mutable SpaceSplitString m_classNames;
+ mutable AtomicString m_idForStyleResolution;
- Attribute m_attributeArray[0];
+ union {
+ Vector<Attribute, 4>* m_mutableAttributeVector;
+ void* m_attributes;
+ };
};
-class MutableElementAttributeData : public ElementAttributeData {
-public:
- MutableElementAttributeData() { }
- MutableElementAttributeData(const ImmutableElementAttributeData&);
-
- Vector<Attribute, 4> m_attributeVector;
-};
-
-inline Vector<Attribute, 4>& ElementAttributeData::mutableAttributeVector()
-{
- ASSERT(m_isMutable);
- return static_cast<MutableElementAttributeData*>(this)->m_attributeVector;
-}
-
-inline const Vector<Attribute, 4>& ElementAttributeData::mutableAttributeVector() const
-{
- ASSERT(m_isMutable);
- return static_cast<const MutableElementAttributeData*>(this)->m_attributeVector;
-}
-
-inline const Attribute* ElementAttributeData::immutableAttributeArray() const
-{
- ASSERT(!m_isMutable);
- return static_cast<const ImmutableElementAttributeData*>(this)->m_attributeArray;
-}
-
inline size_t ElementAttributeData::length() const
{
if (isMutable())
- return mutableAttributeVector().size();
+ return m_mutableAttributeVector->size();
return m_arraySize;
}
@@ -245,31 +201,19 @@
inline const Attribute* ElementAttributeData::attributeItem(unsigned index) const
{
ASSERT(index < length());
- if (m_isMutable)
- return &mutableAttributeVector().at(index);
- return &immutableAttributeArray()[index];
+ if (isMutable())
+ return &m_mutableAttributeVector->at(index);
+ const Attribute* buffer = reinterpret_cast<const Attribute*>(&m_attributes);
+ return &buffer[index];
}
inline Attribute* ElementAttributeData::attributeItem(unsigned index)
{
+ ASSERT(isMutable());
ASSERT(index < length());
- return &mutableAttributeVector().at(index);
+ return &m_mutableAttributeVector->at(index);
}
}
-namespace WTF {
-
-template <> inline void deleteOwnedPtr<WebCore::ElementAttributeData>(WebCore::ElementAttributeData* ptr)
-{
- if (!ptr)
- return;
- if (ptr->isMutable())
- delete static_cast<WebCore::MutableElementAttributeData*>(ptr);
- else
- delete static_cast<WebCore::ImmutableElementAttributeData*>(ptr);
-}
-
-}
-
#endif // ElementAttributeData_h