mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1171282 - Avoid some unnecessary |operator new| null-checks in layout/. r=dholbert.
AllocateByObjectID() is infallible. Therefore the |operator new| of nsFrameList, nsLineBox and nsRuleNode are too, as is nsRuleNode::CreateRootNode(). The patch also removes a couple of comments duplicated in both .h and .cpp files.
This commit is contained in:
parent
26d2f94e04
commit
0652453f28
@ -73,7 +73,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate a nsFrameList from the shell arena.
|
||||
* Infallibly allocate a nsFrameList from the shell arena.
|
||||
*/
|
||||
void* operator new(size_t sz, nsIPresShell* aPresShell) CPP_THROW_NEW;
|
||||
|
||||
|
@ -145,8 +145,6 @@ nsLineBox::NoteFramesMovedFrom(nsLineBox* aFromLine)
|
||||
}
|
||||
}
|
||||
|
||||
// Overloaded new operator. Uses an arena (which comes from the presShell)
|
||||
// to perform the allocation.
|
||||
void*
|
||||
nsLineBox::operator new(size_t sz, nsIPresShell* aPresShell) CPP_THROW_NEW
|
||||
{
|
||||
|
@ -206,8 +206,8 @@ private:
|
||||
nsLineBox(nsIFrame* aFrame, int32_t aCount, bool aIsBlock);
|
||||
~nsLineBox();
|
||||
|
||||
// Overloaded new operator. Uses an arena (which comes from the presShell)
|
||||
// to perform the allocation.
|
||||
// Infallible overloaded new operator. Uses an arena (which comes from the
|
||||
// presShell) to perform the allocation.
|
||||
void* operator new(size_t sz, nsIPresShell* aPresShell) CPP_THROW_NEW;
|
||||
void operator delete(void* aPtr, size_t sz) = delete;
|
||||
|
||||
|
@ -1394,7 +1394,6 @@ SetFactor(const nsCSSValue& aValue, float& aField, bool& aCanStoreInRuleTree,
|
||||
NS_NOTREACHED("SetFactor: inappropriate unit");
|
||||
}
|
||||
|
||||
// Overloaded new operator that allocates from a presShell arena.
|
||||
void*
|
||||
nsRuleNode::operator new(size_t sz, nsPresContext* aPresContext) CPP_THROW_NEW
|
||||
{
|
||||
@ -1554,20 +1553,11 @@ nsRuleNode::Transition(nsIStyleRule* aRule, uint8_t aLevel,
|
||||
else {
|
||||
next = entry->mRuleNode = new (mPresContext)
|
||||
nsRuleNode(mPresContext, this, aRule, aLevel, aIsImportantRule);
|
||||
if (!next) {
|
||||
PL_DHashTableRawRemove(ChildrenHash(), entry);
|
||||
NS_WARNING("out of memory");
|
||||
return this;
|
||||
}
|
||||
}
|
||||
} else if (!next) {
|
||||
// Create the new entry in our list.
|
||||
next = new (mPresContext)
|
||||
nsRuleNode(mPresContext, this, aRule, aLevel, aIsImportantRule);
|
||||
if (!next) {
|
||||
NS_WARNING("out of memory");
|
||||
return this;
|
||||
}
|
||||
next->mNextSibling = ChildrenList();
|
||||
SetChildrenList(next);
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ private:
|
||||
uint32_t mRefCnt;
|
||||
|
||||
public:
|
||||
// Overloaded new operator that allocates from a presShell arena.
|
||||
// Infallible overloaded new operator that allocates from a presShell arena.
|
||||
void* operator new(size_t sz, nsPresContext* aContext) CPP_THROW_NEW;
|
||||
void Destroy() { DestroyInternal(nullptr); }
|
||||
|
||||
@ -651,6 +651,7 @@ private:
|
||||
~nsRuleNode();
|
||||
|
||||
public:
|
||||
// This is infallible; it will never return nullptr.
|
||||
static nsRuleNode* CreateRootNode(nsPresContext* aPresContext);
|
||||
|
||||
static void EnsureBlockDisplay(uint8_t& display,
|
||||
|
@ -218,10 +218,7 @@ nsStyleSet::BeginReconstruct()
|
||||
NS_ASSERTION(mRuleTree, "Reconstructing before first construction?");
|
||||
|
||||
// Create a new rule tree root
|
||||
nsRuleNode* newTree =
|
||||
nsRuleNode::CreateRootNode(mRuleTree->PresContext());
|
||||
if (!newTree)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
nsRuleNode* newTree = nsRuleNode::CreateRootNode(mRuleTree->PresContext());
|
||||
|
||||
// Save the old rule tree so we can destroy it later
|
||||
if (!mOldRuleTrees.AppendElement(mRuleTree)) {
|
||||
|
Loading…
Reference in New Issue
Block a user