[webkit-reviews] review granted: [Bug 204520] Make CSSValuePool constructable : [Attachment 384158] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Nov 22 09:09:59 PST 2019
Antti Koivisto <koivisto at iki.fi> has granted Chris Lord <clord at igalia.com>'s
request for review:
Bug 204520: Make CSSValuePool constructable
https://bugs.webkit.org/show_bug.cgi?id=204520
Attachment 384158: Patch
https://bugs.webkit.org/attachment.cgi?id=384158&action=review
--- Comment #2 from Antti Koivisto <koivisto at iki.fi> ---
Comment on attachment 384158
--> https://bugs.webkit.org/attachment.cgi?id=384158
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=384158&action=review
> Source/WebCore/css/CSSValuePool.cpp:60
> for (unsigned i = firstCSSValueKeyword; i <= lastCSSValueKeyword; ++i)
> - m_identifierValues[i].construct(static_cast<CSSValueID>(i));
> +
m_identifierValues.append(CSSPrimitiveValue::create(static_cast<CSSValueID>(i))
);
>
> for (unsigned i = 0; i < (maximumCacheableIntegerValue + 1); ++i) {
> - m_pixelValues[i].construct(i, CSSUnitType::CSS_PX);
> - m_percentValues[i].construct(i, CSSUnitType::CSS_PERCENTAGE);
> - m_numberValues[i].construct(i, CSSUnitType::CSS_NUMBER);
> + m_pixelValues.append(CSSPrimitiveValue::create(i,
CSSUnitType::CSS_PX));
> + m_percentValues.append(CSSPrimitiveValue::create(i,
CSSUnitType::CSS_PERCENTAGE));
> + m_numberValues.append(CSSPrimitiveValue::create(i,
CSSUnitType::CSS_NUMBER));
> }
If you stick with the vector you should at least reserveCapacity and use
uncheckedAppend
> Source/WebCore/css/CSSValuePool.h:101
> - LazyNeverDestroyed<CSSPrimitiveValue>
m_pixelValues[maximumCacheableIntegerValue + 1];
> - LazyNeverDestroyed<CSSPrimitiveValue>
m_percentValues[maximumCacheableIntegerValue + 1];
> - LazyNeverDestroyed<CSSPrimitiveValue>
m_numberValues[maximumCacheableIntegerValue + 1];
> - LazyNeverDestroyed<CSSPrimitiveValue>
m_identifierValues[numCSSValueKeywords];
> + Vector<Ref<CSSPrimitiveValue>> m_pixelValues;
> + Vector<Ref<CSSPrimitiveValue>> m_percentValues;
> + Vector<Ref<CSSPrimitiveValue>> m_numberValues;
> + Vector<Ref<CSSPrimitiveValue>> m_identifierValues;
You could use std::array since these are fixed sized.
More information about the webkit-reviews
mailing list