Commit 0930f30b authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

heap: Make all flags used for TraceAfterDispatch const

TraceAfterDispatch is used avoid adding vtables to types. Instead a
flag in the object is used to choose the right Trace method. This CL
changes all the non-const flags used for dispatching to const.

Change-Id: I29b1817b56808360c27b31dd41b98c5ae5ece1a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2078533Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745062}
parent 0b0c1ea5
......@@ -159,7 +159,7 @@ class CORE_EXPORT CSSPropertyValueSet
}
unsigned css_parser_mode_ : 3;
mutable unsigned is_mutable_ : 1;
const unsigned is_mutable_ : 1;
unsigned array_size_ : 28;
friend class PropertySetCSSStyleDeclaration;
......
......@@ -294,7 +294,7 @@ class CORE_EXPORT CSSValue : public GarbageCollected<CSSValue> {
unsigned allows_negative_percentage_reference_ : 1;
private:
unsigned class_type_ : kClassTypeBits; // ClassType
const unsigned class_type_ : kClassTypeBits; // ClassType
};
template <typename CSSValueType, wtf_size_t inlineCapacity>
......
......@@ -91,7 +91,7 @@ class CORE_EXPORT StyleRuleBase : public GarbageCollected<StyleRuleBase> {
CSSRule* CreateCSSOMWrapper(CSSStyleSheet* parent_sheet,
CSSRule* parent_rule) const;
unsigned type_ : 5;
const unsigned type_ : 5;
};
// A single rule from a stylesheet. Contains a selector list (one or more
......
......@@ -111,10 +111,13 @@ bool ElementData::IsEquivalent(const ElementData* other) const {
}
void ElementData::Trace(Visitor* visitor) {
if (auto* unique_element_data = DynamicTo<UniqueElementData>(this))
unique_element_data->TraceAfterDispatch(visitor);
else
if (is_unique_) {
DCHECK(DynamicTo<UniqueElementData>(this));
To<UniqueElementData>(this)->TraceAfterDispatch(visitor);
} else {
DCHECK(DynamicTo<ShareableElementData>(this));
To<ShareableElementData>(this)->TraceAfterDispatch(visitor);
}
}
void ElementData::TraceAfterDispatch(blink::Visitor* visitor) {
......
......@@ -90,7 +90,7 @@ class ElementData : public GarbageCollected<ElementData> {
// Keep the type in a bitfield instead of using virtual destructors to avoid
// adding a vtable.
unsigned is_unique_ : 1;
const unsigned is_unique_ : 1;
unsigned array_size_ : 28;
mutable unsigned presentation_attribute_style_is_dirty_ : 1;
mutable unsigned style_attribute_is_dirty_ : 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment