http://trac.webkit.org/changeset/143044
https://bugs.webkit.org/show_bug.cgi?id=109974
broke windows build (Requested by kling on #webkit).
Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2013-02-15
* dom/DocumentSharedObjectPool.cpp:
(WebCore::DocumentSharedObjectPool::cachedShareableElementDataWithAttributes):
* dom/Element.cpp:
(WebCore::sizeForShareableElementDataWithAttributeCount):
(WebCore::ShareableElementData::ShareableElementData):
(WebCore::ShareableElementData::~ShareableElementData):
(WebCore::UniqueElementData::UniqueElementData):
* dom/Element.h:
(WebCore::ShareableElementData::immutableAttributeArray):
(ShareableElementData):
(WebCore::ElementData::attributeItem):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143054
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2013-02-15 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r143044.
+ http://trac.webkit.org/changeset/143044
+ https://bugs.webkit.org/show_bug.cgi?id=109974
+
+ broke windows build (Requested by kling on #webkit).
+
+ * dom/DocumentSharedObjectPool.cpp:
+ (WebCore::DocumentSharedObjectPool::cachedShareableElementDataWithAttributes):
+ * dom/Element.cpp:
+ (WebCore::sizeForShareableElementDataWithAttributeCount):
+ (WebCore::ShareableElementData::ShareableElementData):
+ (WebCore::ShareableElementData::~ShareableElementData):
+ (WebCore::UniqueElementData::UniqueElementData):
+ * dom/Element.h:
+ (WebCore::ShareableElementData::immutableAttributeArray):
+ (ShareableElementData):
+ (WebCore::ElementData::attributeItem):
+
2013-02-15 Adam Barth <abarth@webkit.org>
Enable the preload scanner on the background parser thread
if (!cacheHash || cacheIterator->value)
return elementData.release();
- cacheIterator->value = adoptPtr(new ShareableElementDataCacheEntry(ShareableElementDataCacheKey(elementData->m_attributeArray, elementData->length()), elementData));
+ cacheIterator->value = adoptPtr(new ShareableElementDataCacheEntry(ShareableElementDataCacheKey(elementData->immutableAttributeArray(), elementData->length()), elementData));
return elementData.release();
}
static size_t sizeForShareableElementDataWithAttributeCount(unsigned count)
{
- return sizeof(ShareableElementData) + sizeof(Attribute) * count;
+ return sizeof(ShareableElementData) - sizeof(void*) + sizeof(Attribute) * count;
}
PassRefPtr<ShareableElementData> ShareableElementData::createWithAttributes(const Vector<Attribute>& attributes)
: ElementData(attributes.size())
{
for (unsigned i = 0; i < m_arraySize; ++i)
- new (&m_attributeArray[i]) Attribute(attributes[i]);
+ new (&reinterpret_cast<Attribute*>(&m_attributeArray)[i]) Attribute(attributes[i]);
}
ShareableElementData::~ShareableElementData()
{
for (unsigned i = 0; i < m_arraySize; ++i)
- m_attributeArray[i].~Attribute();
+ (reinterpret_cast<Attribute*>(&m_attributeArray)[i]).~Attribute();
}
ShareableElementData::ShareableElementData(const UniqueElementData& other)
}
for (unsigned i = 0; i < m_arraySize; ++i)
- new (&m_attributeArray[i]) Attribute(other.m_attributeVector.at(i));
+ new (&reinterpret_cast<Attribute*>(&m_attributeArray)[i]) Attribute(other.m_attributeVector.at(i));
}
ElementData::ElementData(const ElementData& other, bool isUnique)
m_attributeVector.reserveCapacity(other.length());
for (unsigned i = 0; i < other.length(); ++i)
- m_attributeVector.uncheckedAppend(other.m_attributeArray[i]);
+ m_attributeVector.uncheckedAppend(other.immutableAttributeArray()[i]);
}
PassRefPtr<UniqueElementData> ElementData::makeUniqueCopy() const
PassRefPtr<UniqueElementData> makeUniqueCopy() const;
};
-#if COMPILER(MSVC)
-#pragma warning(push)
-#pragma warning(disable: 4200) // Disable "zero-sized array in struct/union" warning
-#endif
-
class ShareableElementData : public ElementData {
public:
static PassRefPtr<ShareableElementData> createWithAttributes(const Vector<Attribute>&);
+ const Attribute* immutableAttributeArray() const { return reinterpret_cast<const Attribute*>(&m_attributeArray); }
+
explicit ShareableElementData(const Vector<Attribute>&);
explicit ShareableElementData(const UniqueElementData&);
~ShareableElementData();
- Attribute m_attributeArray[0];
+ void* m_attributeArray;
};
-#if COMPILER(MSVC)
-#pragma warning(pop)
-#endif
-
class UniqueElementData : public ElementData {
public:
static PassRefPtr<UniqueElementData> create();
ASSERT_WITH_SECURITY_IMPLICATION(index < length());
if (m_isUnique)
return &static_cast<const UniqueElementData*>(this)->m_attributeVector.at(index);
- return &static_cast<const ShareableElementData*>(this)->m_attributeArray[index];
+ return &static_cast<const ShareableElementData*>(this)->immutableAttributeArray()[index];
}
} // namespace