зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1038488 patch 2 - Remove memset from the operator new of the 4 style structs that have it. r=heycam
This also moves those 4 operator new methods to be inline to match the style of all of the others. I audited that all the members of these structs are initialized by all their constructors (see patch 1).
This commit is contained in:
Родитель
8e7821b091
Коммит
a084fec891
|
@ -156,14 +156,6 @@ nsStyleFont::Init(nsPresContext* aPresContext)
|
|||
}
|
||||
}
|
||||
|
||||
void*
|
||||
nsStyleFont::operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
||||
void* result = aContext->AllocateFromShell(sz);
|
||||
if (result)
|
||||
memset(result, 0, sz);
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleFont::Destroy(nsPresContext* aContext) {
|
||||
this->~nsStyleFont();
|
||||
|
@ -292,14 +284,6 @@ nsStyleMargin::nsStyleMargin(const nsStyleMargin& aSrc)
|
|||
MOZ_COUNT_CTOR(nsStyleMargin);
|
||||
}
|
||||
|
||||
void*
|
||||
nsStyleMargin::operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
||||
void* result = aContext->AllocateFromShell(sz);
|
||||
if (result)
|
||||
memset(result, 0, sz);
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleMargin::Destroy(nsPresContext* aContext) {
|
||||
this->~nsStyleMargin();
|
||||
|
@ -349,14 +333,6 @@ nsStylePadding::nsStylePadding(const nsStylePadding& aSrc)
|
|||
MOZ_COUNT_CTOR(nsStylePadding);
|
||||
}
|
||||
|
||||
void*
|
||||
nsStylePadding::operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
||||
void* result = aContext->AllocateFromShell(sz);
|
||||
if (result)
|
||||
memset(result, 0, sz);
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
nsStylePadding::Destroy(nsPresContext* aContext) {
|
||||
this->~nsStylePadding();
|
||||
|
@ -480,14 +456,6 @@ nsStyleBorder::~nsStyleBorder()
|
|||
}
|
||||
}
|
||||
|
||||
void*
|
||||
nsStyleBorder::operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
||||
void* result = aContext->AllocateFromShell(sz);
|
||||
if (result)
|
||||
memset(result, 0, sz);
|
||||
return result;
|
||||
}
|
||||
|
||||
nsMargin
|
||||
nsStyleBorder::GetImageOutset() const
|
||||
{
|
||||
|
|
|
@ -88,7 +88,9 @@ public:
|
|||
static nscoord ZoomText(nsPresContext* aPresContext, nscoord aSize);
|
||||
static nscoord UnZoomText(nsPresContext* aPresContext, nscoord aSize);
|
||||
|
||||
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW;
|
||||
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
||||
return aContext->AllocateFromShell(sz);
|
||||
}
|
||||
void Destroy(nsPresContext* aContext);
|
||||
|
||||
void EnableZoom(nsPresContext* aContext, bool aEnable);
|
||||
|
@ -567,7 +569,9 @@ struct nsStyleMargin {
|
|||
MOZ_COUNT_DTOR(nsStyleMargin);
|
||||
}
|
||||
|
||||
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW;
|
||||
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
||||
return aContext->AllocateFromShell(sz);
|
||||
}
|
||||
void Destroy(nsPresContext* aContext);
|
||||
|
||||
void RecalcData();
|
||||
|
@ -608,7 +612,9 @@ struct nsStylePadding {
|
|||
MOZ_COUNT_DTOR(nsStylePadding);
|
||||
}
|
||||
|
||||
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW;
|
||||
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
||||
return aContext->AllocateFromShell(sz);
|
||||
}
|
||||
void Destroy(nsPresContext* aContext);
|
||||
|
||||
void RecalcData();
|
||||
|
@ -795,7 +801,9 @@ struct nsStyleBorder {
|
|||
nsStyleBorder(const nsStyleBorder& aBorder);
|
||||
~nsStyleBorder();
|
||||
|
||||
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW;
|
||||
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW {
|
||||
return aContext->AllocateFromShell(sz);
|
||||
}
|
||||
void Destroy(nsPresContext* aContext);
|
||||
|
||||
nsChangeHint CalcDifference(const nsStyleBorder& aOther) const;
|
||||
|
|
Загрузка…
Ссылка в новой задаче