Issue #2112 - Part 11: Remove dead off-thread Stylo functions in nsStyleStruct

This commit is contained in:
FranklinDM 2024-03-25 21:11:28 +08:00 committed by roytam1
commit 4b44df794b
2 changed files with 3 additions and 171 deletions

View file

@ -160,7 +160,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleFont
~nsStyleFont() {
MOZ_COUNT_DTOR(nsStyleFont);
}
void FinishStyle(nsPresContext* aPresContext) {}
nsChangeHint CalcDifference(const nsStyleFont& aNewData) const;
static nsChangeHint MaxDifference() {
@ -286,19 +285,9 @@ private:
* A wrapper for an imgRequestProxy that supports off-main-thread creation
* and equality comparison.
*
* An nsStyleImageRequest can be created in two ways:
*
* 1. Using the constructor that takes an imgRequestProxy. This must
* be called from the main thread. The nsStyleImageRequest is
* immediately considered "resolved", and the get() method that
* returns the imgRequestProxy can be called.
*
* 2. Using the constructor that takes the URL, base URI, referrer
* and principal that can be used to inititiate an image load and
* produce an imgRequestProxy later. This can be called from
* any thread. The nsStyleImageRequest is not considered "resolved"
* at this point, and the Resolve() method must be called later
* to initiate the image load and make calls to get() valid.
* An nsStyleImageRequest can be created using the constructor that takes an
* imgRequestProxy. This must be called from the main thread. The get()
* method that returns the imgRequestProxy can be called immediately.
*
* Calls to TrackImage(), UntrackImage(), LockImage(), UnlockImage() and
* RequestDiscard() are made to the imgRequestProxy and ImageTracker as
@ -343,20 +332,7 @@ public:
mozilla::css::ImageValue* aImageValue,
mozilla::dom::ImageTracker* aImageTracker);
// Can be called from any thread, but Resolve() must be called later
// on the main thread before get() can be used.
nsStyleImageRequest(
Mode aModeFlags,
nsStringBuffer* aURLBuffer,
already_AddRefed<mozilla::PtrHolder<nsIURI>> aBaseURI,
already_AddRefed<mozilla::PtrHolder<nsIURI>> aReferrer,
already_AddRefed<mozilla::PtrHolder<nsIPrincipal>> aPrincipal);
bool Resolve(nsPresContext* aPresContext);
bool IsResolved() const { return mResolved; }
imgRequestProxy* get() {
MOZ_ASSERT(IsResolved(), "Resolve() must be called first");
MOZ_ASSERT(NS_IsMainThread());
return mRequestProxy.get();
}
@ -381,7 +357,6 @@ private:
RefPtr<mozilla::dom::ImageTracker> mImageTracker;
Mode mModeFlags;
bool mResolved;
};
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(nsStyleImageRequest::Mode)
@ -434,13 +409,6 @@ struct nsStyleImage
void SetElementId(const char16_t* aElementId);
void SetCropRect(mozilla::UniquePtr<nsStyleSides> aCropRect);
void ResolveImage(nsPresContext* aContext) {
MOZ_ASSERT(mType != eStyleImageType_Image || mImage);
if (mType == eStyleImageType_Image && !mImage->IsResolved()) {
mImage->Resolve(aContext);
}
}
nsStyleImageType GetType() const {
return mType;
}
@ -560,7 +528,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColor
~nsStyleColor() {
MOZ_COUNT_DTOR(nsStyleColor);
}
void FinishStyle(nsPresContext* aPresContext) {}
nscolor CalcComplexColor(const mozilla::StyleComplexColor& aColor) const {
return mozilla::LinearBlendColors(aColor.mColor, mColor,
@ -831,12 +798,6 @@ struct nsStyleImageLayers {
// Initialize mRepeat and mOrigin by specified layer type
void Initialize(LayerType aType);
void ResolveImage(nsPresContext* aContext) {
if (mImage.GetType() == eStyleImageType_Image) {
mImage.ResolveImage(aContext);
}
}
// True if the rendering of this layer might change when the size
// of the background positioning area changes. This is true for any
// non-solid-color background whose position or size depends on
@ -883,12 +844,6 @@ struct nsStyleImageLayers {
const Layer& BottomLayer() const { return mLayers[mImageCount - 1]; }
void ResolveImages(nsPresContext* aContext) {
for (uint32_t i = 0; i < mImageCount; ++i) {
mLayers[i].ResolveImage(aContext);
}
}
nsChangeHint CalcDifference(const nsStyleImageLayers& aNewLayers,
nsStyleImageLayers::LayerType aType) const;
@ -911,11 +866,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBackground {
nsStyleBackground(const nsStyleBackground& aOther);
~nsStyleBackground();
// Resolves and tracks the images in mImage. Only called with a Servo-backed
// style system, where those images must be resolved later than the OMT
// nsStyleBackground constructor call.
void FinishStyle(nsPresContext* aPresContext);
void* operator new(size_t sz, nsStyleBackground* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
return aContext->PresShell()->
@ -967,7 +917,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleMargin
~nsStyleMargin() {
MOZ_COUNT_DTOR(nsStyleMargin);
}
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleMargin* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -1015,7 +964,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePadding
~nsStylePadding() {
MOZ_COUNT_DTOR(nsStylePadding);
}
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStylePadding* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -1227,11 +1175,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder
nsStyleBorder(const nsStyleBorder& aBorder);
~nsStyleBorder();
// Resolves and tracks mBorderImageSource. Only called with a Servo-backed
// style system, where those images must be resolved later than the OMT
// nsStyleBorder constructor call.
void FinishStyle(nsPresContext* aPresContext);
void* operator new(size_t sz, nsStyleBorder* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
return aContext->PresShell()->
@ -1334,13 +1277,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder
return mBorderImageSource.IsLoaded();
}
void ResolveImage(nsPresContext* aContext)
{
if (mBorderImageSource.GetType() == eStyleImageType_Image) {
mBorderImageSource.ResolveImage(aContext);
}
}
nsMargin GetImageOutset() const;
void GetCompositeColors(int32_t aIndex, nsBorderColors** aColors) const
@ -1454,7 +1390,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleOutline
~nsStyleOutline() {
MOZ_COUNT_DTOR(nsStyleOutline);
}
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleOutline* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -1529,8 +1464,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleList
nsStyleList(const nsStyleList& aStyleList);
~nsStyleList();
void FinishStyle(nsPresContext* aPresContext);
void* operator new(size_t sz, nsStyleList* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
return aContext->PresShell()->
@ -1754,7 +1687,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStylePosition
explicit nsStylePosition(StyleStructContext aContext);
nsStylePosition(const nsStylePosition& aOther);
~nsStylePosition();
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStylePosition* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -1992,7 +1924,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTextReset
explicit nsStyleTextReset(StyleStructContext aContext);
nsStyleTextReset(const nsStyleTextReset& aOther);
~nsStyleTextReset();
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleTextReset* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -2041,7 +1972,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText
explicit nsStyleText(StyleStructContext aContext);
nsStyleText(const nsStyleText& aOther);
~nsStyleText();
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleText* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -2269,7 +2199,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVisibility
~nsStyleVisibility() {
MOZ_COUNT_DTOR(nsStyleVisibility);
}
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleVisibility* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -2777,7 +2706,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay
~nsStyleDisplay() {
MOZ_COUNT_DTOR(nsStyleDisplay);
}
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleDisplay* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -3091,7 +3019,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTable
explicit nsStyleTable(StyleStructContext aContext);
nsStyleTable(const nsStyleTable& aOther);
~nsStyleTable();
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleTable* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -3123,7 +3050,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleTableBorder
explicit nsStyleTableBorder(StyleStructContext aContext);
nsStyleTableBorder(const nsStyleTableBorder& aOther);
~nsStyleTableBorder();
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleTableBorder* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -3232,7 +3158,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleContent
explicit nsStyleContent(StyleStructContext aContext);
nsStyleContent(const nsStyleContent& aContent);
~nsStyleContent();
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleContent* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -3313,7 +3238,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset
explicit nsStyleUIReset(StyleStructContext aContext);
nsStyleUIReset(const nsStyleUIReset& aOther);
~nsStyleUIReset();
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleUIReset* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -3386,7 +3310,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUserInterface
explicit nsStyleUserInterface(StyleStructContext aContext);
nsStyleUserInterface(const nsStyleUserInterface& aOther);
~nsStyleUserInterface();
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleUserInterface* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -3432,7 +3355,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleXUL
explicit nsStyleXUL(StyleStructContext aContext);
nsStyleXUL(const nsStyleXUL& aSource);
~nsStyleXUL();
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleXUL* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -3472,7 +3394,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleColumn
explicit nsStyleColumn(StyleStructContext aContext);
nsStyleColumn(const nsStyleColumn& aSource);
~nsStyleColumn();
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleColumn* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -3596,7 +3517,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVG
explicit nsStyleSVG(StyleStructContext aContext);
nsStyleSVG(const nsStyleSVG& aSource);
~nsStyleSVG();
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleSVG* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -3730,7 +3650,6 @@ struct nsStyleFilter
nsStyleFilter();
nsStyleFilter(const nsStyleFilter& aSource);
~nsStyleFilter();
void FinishStyle(nsPresContext* aPresContext) {}
nsStyleFilter& operator=(const nsStyleFilter& aOther);
@ -3788,11 +3707,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVGReset
nsStyleSVGReset(const nsStyleSVGReset& aSource);
~nsStyleSVGReset();
// Resolves and tracks the images in mMask. Only called with a Servo-backed
// style system, where those images must be resolved later than the OMT
// nsStyleSVGReset constructor call.
void FinishStyle(nsPresContext* aPresContext);
void* operator new(size_t sz, nsStyleSVGReset* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
return aContext->PresShell()->
@ -3844,7 +3758,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleVariables
explicit nsStyleVariables(StyleStructContext aContext);
nsStyleVariables(const nsStyleVariables& aSource);
~nsStyleVariables();
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleVariables* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {
@ -3875,7 +3788,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleEffects
explicit nsStyleEffects(StyleStructContext aContext);
nsStyleEffects(const nsStyleEffects& aSource);
~nsStyleEffects();
void FinishStyle(nsPresContext* aPresContext) {}
void* operator new(size_t sz, nsStyleEffects* aSelf) { return aSelf; }
void* operator new(size_t sz, nsPresContext* aContext) {