Bug 1038488 patch 3 - Use AllocateByObjectID/FreeByObjectID for style structs. r=heycam

This commit is contained in:
L. David Baron 2014-07-15 22:27:13 -07:00
Родитель a084fec891
Коммит 6b85a58773
3 изменённых файлов: 107 добавлений и 48 удалений

Просмотреть файл

@ -32,6 +32,17 @@ public:
nsStyleContext_id,
nsFrameList_id,
First_nsStyleStruct_id,
DummyBeforeStyleStructs_id = First_nsStyleStruct_id - 1,
#define STYLE_STRUCT(name_, checkdata_cb_) \
nsStyle##name_##_id,
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
DummyAfterStyleStructs_id,
Last_nsStyleStruct_id = DummyAfterStyleStructs_id - 1,
/**
* The PresArena implementation uses this bit to distinguish objects
* allocated by size from objects allocated by type ID (that is, frames

Просмотреть файл

@ -159,7 +159,8 @@ nsStyleFont::Init(nsPresContext* aPresContext)
void
nsStyleFont::Destroy(nsPresContext* aContext) {
this->~nsStyleFont();
aContext->FreeToShell(sizeof(nsStyleFont), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleFont_id, this);
}
void
@ -287,7 +288,8 @@ nsStyleMargin::nsStyleMargin(const nsStyleMargin& aSrc)
void
nsStyleMargin::Destroy(nsPresContext* aContext) {
this->~nsStyleMargin();
aContext->FreeToShell(sizeof(nsStyleMargin), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleMargin_id, this);
}
@ -336,7 +338,8 @@ nsStylePadding::nsStylePadding(const nsStylePadding& aSrc)
void
nsStylePadding::Destroy(nsPresContext* aContext) {
this->~nsStylePadding();
aContext->FreeToShell(sizeof(nsStylePadding), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStylePadding_id, this);
}
void nsStylePadding::RecalcData()
@ -487,7 +490,8 @@ void
nsStyleBorder::Destroy(nsPresContext* aContext) {
UntrackImage(aContext);
this->~nsStyleBorder();
aContext->FreeToShell(sizeof(nsStyleBorder), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleBorder_id, this);
}
nsChangeHint nsStyleBorder::CalcDifference(const nsStyleBorder& aOther) const
@ -2027,7 +2031,8 @@ nsStyleBackground::Destroy(nsPresContext* aContext)
mLayers[i].UntrackImages(aContext);
this->~nsStyleBackground();
aContext->FreeToShell(sizeof(nsStyleBackground), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleBackground_id, this);
}
nsChangeHint nsStyleBackground::CalcDifference(const nsStyleBackground& aOther) const
@ -2789,7 +2794,8 @@ nsStyleContent::Destroy(nsPresContext* aContext)
}
this->~nsStyleContent();
aContext->FreeToShell(sizeof(nsStyleContent), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleContent_id, this);
}
nsStyleContent::nsStyleContent(const nsStyleContent& aSource)

Просмотреть файл

@ -89,7 +89,8 @@ public:
static nscoord UnZoomText(nsPresContext* aPresContext, nscoord aSize);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleFont_id, sz);
}
void Destroy(nsPresContext* aContext);
@ -325,11 +326,13 @@ struct nsStyleColor {
}
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleColor_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleColor();
aContext->FreeToShell(sizeof(nsStyleColor), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleColor_id, this);
}
// Don't add ANY members to this struct! We can achieve caching in the rule
@ -343,7 +346,8 @@ struct nsStyleBackground {
~nsStyleBackground();
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleBackground_id, sz);
}
void Destroy(nsPresContext* aContext);
@ -570,7 +574,8 @@ struct nsStyleMargin {
}
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleMargin_id, sz);
}
void Destroy(nsPresContext* aContext);
@ -613,7 +618,8 @@ struct nsStylePadding {
}
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStylePadding_id, sz);
}
void Destroy(nsPresContext* aContext);
@ -802,7 +808,8 @@ struct nsStyleBorder {
~nsStyleBorder();
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleBorder_id, sz);
}
void Destroy(nsPresContext* aContext);
@ -1029,11 +1036,13 @@ struct nsStyleOutline {
}
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleOutline_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleOutline();
aContext->FreeToShell(sizeof(nsStyleOutline), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleOutline_id, this);
}
void RecalcData(nsPresContext* aContext);
@ -1122,11 +1131,13 @@ struct nsStyleList {
~nsStyleList(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleList_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleList();
aContext->FreeToShell(sizeof(nsStyleList), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleList_id, this);
}
nsChangeHint CalcDifference(const nsStyleList& aOther) const;
@ -1288,11 +1299,13 @@ struct nsStylePosition {
~nsStylePosition(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStylePosition_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStylePosition();
aContext->FreeToShell(sizeof(nsStylePosition), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStylePosition_id, this);
}
nsChangeHint CalcDifference(const nsStylePosition& aOther) const;
@ -1438,11 +1451,13 @@ struct nsStyleTextReset {
~nsStyleTextReset(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleTextReset_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleTextReset();
aContext->FreeToShell(sizeof(nsStyleTextReset), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleTextReset_id, this);
}
uint8_t GetDecorationStyle() const
@ -1512,11 +1527,13 @@ struct nsStyleText {
~nsStyleText(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleText_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleText();
aContext->FreeToShell(sizeof(nsStyleText), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleText_id, this);
}
nsChangeHint CalcDifference(const nsStyleText& aOther) const;
@ -1699,11 +1716,13 @@ struct nsStyleVisibility {
}
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleVisibility_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleVisibility();
aContext->FreeToShell(sizeof(nsStyleVisibility), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleVisibility_id, this);
}
nsChangeHint CalcDifference(const nsStyleVisibility& aOther) const;
@ -1911,11 +1930,13 @@ struct nsStyleDisplay {
}
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleDisplay_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleDisplay();
aContext->FreeToShell(sizeof(nsStyleDisplay), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleDisplay_id, this);
}
nsChangeHint CalcDifference(const nsStyleDisplay& aOther) const;
@ -2111,11 +2132,13 @@ struct nsStyleTable {
~nsStyleTable(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleTable_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleTable();
aContext->FreeToShell(sizeof(nsStyleTable), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleTable_id, this);
}
nsChangeHint CalcDifference(const nsStyleTable& aOther) const;
@ -2141,11 +2164,13 @@ struct nsStyleTableBorder {
~nsStyleTableBorder(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleTableBorder_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleTableBorder();
aContext->FreeToShell(sizeof(nsStyleTableBorder), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleTableBorder_id, this);
}
nsChangeHint CalcDifference(const nsStyleTableBorder& aOther) const;
@ -2234,11 +2259,13 @@ struct nsStyleQuotes {
~nsStyleQuotes();
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleQuotes_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleQuotes();
aContext->FreeToShell(sizeof(nsStyleQuotes), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleQuotes_id, this);
}
void SetInitial();
@ -2313,7 +2340,8 @@ struct nsStyleContent {
~nsStyleContent(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleContent_id, sz);
}
void Destroy(nsPresContext* aContext);
@ -2420,11 +2448,13 @@ struct nsStyleUIReset {
~nsStyleUIReset(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleUIReset_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleUIReset();
aContext->FreeToShell(sizeof(nsStyleUIReset), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleUIReset_id, this);
}
nsChangeHint CalcDifference(const nsStyleUIReset& aOther) const;
@ -2479,11 +2509,13 @@ struct nsStyleUserInterface {
~nsStyleUserInterface(void);
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleUserInterface_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleUserInterface();
aContext->FreeToShell(sizeof(nsStyleUserInterface), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleUserInterface_id, this);
}
nsChangeHint CalcDifference(const nsStyleUserInterface& aOther) const;
@ -2520,11 +2552,13 @@ struct nsStyleXUL {
~nsStyleXUL();
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleXUL_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleXUL();
aContext->FreeToShell(sizeof(nsStyleXUL), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleXUL_id, this);
}
nsChangeHint CalcDifference(const nsStyleXUL& aOther) const;
@ -2553,11 +2587,13 @@ struct nsStyleColumn {
~nsStyleColumn();
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleColumn_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleColumn();
aContext->FreeToShell(sizeof(nsStyleColumn), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleColumn_id, this);
}
nsChangeHint CalcDifference(const nsStyleColumn& aOther) const;
@ -2642,11 +2678,13 @@ struct nsStyleSVG {
~nsStyleSVG();
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleSVG_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleSVG();
aContext->FreeToShell(sizeof(nsStyleSVG), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleSVG_id, this);
}
nsChangeHint CalcDifference(const nsStyleSVG& aOther) const;
@ -2779,11 +2817,13 @@ struct nsStyleSVGReset {
~nsStyleSVGReset();
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleSVGReset_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleSVGReset();
aContext->FreeToShell(sizeof(nsStyleSVGReset), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleSVGReset_id, this);
}
nsChangeHint CalcDifference(const nsStyleSVGReset& aOther) const;
@ -2823,11 +2863,13 @@ struct nsStyleVariables {
~nsStyleVariables();
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
return aContext->AllocateFromShell(sz);
return aContext->PresShell()->
AllocateByObjectID(nsPresArena::nsStyleVariables_id, sz);
}
void Destroy(nsPresContext* aContext) {
this->~nsStyleVariables();
aContext->FreeToShell(sizeof(nsStyleVariables), this);
aContext->PresShell()->
FreeByObjectID(nsPresArena::nsStyleVariables_id, this);
}
nsChangeHint CalcDifference(const nsStyleVariables& aOther) const;