Bug 1464496 - Part 2: Move the mRaw before the two booleans for better packing r?emilio
MozReview-Commit-ID: Gi4Is7RgVmN
--- a/layout/style/DeclarationBlock.h
+++ b/layout/style/DeclarationBlock.h
@@ -26,30 +26,30 @@ class Declaration;
class Rule;
} // namespace css
class DeclarationBlock final
{
public:
explicit DeclarationBlock(
already_AddRefed<RawServoDeclarationBlock> aRaw)
- : mImmutable(false)
+ : mRaw(aRaw)
+ , mImmutable(false)
, mIsDirty(false)
- , mRaw(aRaw)
{
mContainer.mRaw = 0;
}
DeclarationBlock()
: DeclarationBlock(Servo_DeclarationBlock_CreateEmpty().Consume()) {}
DeclarationBlock(const DeclarationBlock& aCopy)
- : mImmutable(false)
+ : mRaw(Servo_DeclarationBlock_Clone(aCopy.mRaw).Consume())
+ , mImmutable(false)
, mIsDirty(false)
- , mRaw(Servo_DeclarationBlock_Clone(aCopy.mRaw).Consume())
{
mContainer.mRaw = 0;
}
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DeclarationBlock)
inline already_AddRefed<DeclarationBlock> Clone() const
{
@@ -204,30 +204,30 @@ private:
// The style rule that owns this declaration. May be null.
css::Rule* mOwningRule;
// The nsHTMLCSSStyleSheet that is responsible for this declaration.
// Only non-null for style attributes.
nsHTMLCSSStyleSheet* mHTMLCSSStyleSheet;
} mContainer;
+ RefPtr<RawServoDeclarationBlock> mRaw;
+
// set when declaration put in the rule tree;
bool mImmutable;
// True if this declaration has not been restyled after modified.
//
// Since we can clear this flag from style worker threads, we use an Atomic.
//
// Note that although a single DeclarationBlock can be shared between
// different rule nodes (due to the style="" attribute cache), whenever a
// DeclarationBlock has its mIsDirty flag set to true, we always clone it to
// a unique object first. So when we clear this flag during Servo traversal,
// we know that we are clearing it on a DeclarationBlock that has a single
// reference, and there is no problem with another user of the same
// DeclarationBlock thinking that it is not dirty.
Atomic<bool, MemoryOrdering::Relaxed> mIsDirty;
-
- RefPtr<RawServoDeclarationBlock> mRaw;
};
} // namespace mozilla
#endif // mozilla_DeclarationBlock_h