зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1489702 - Move mClipChainsToDestroy inline r=mattwoodrow
Fairly straightforward - went with extra indirection in the FreeClipChains method to avoid all the extra variables and code paths. Differential Revision: https://phabricator.services.mozilla.com/D5342 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
400093bdb6
Коммит
bf43d69d72
|
@ -67,10 +67,12 @@ struct DisplayItemClipChain
|
||||||
|
|
||||||
DisplayItemClipChain(const DisplayItemClip& aClip,
|
DisplayItemClipChain(const DisplayItemClip& aClip,
|
||||||
const ActiveScrolledRoot* aASR,
|
const ActiveScrolledRoot* aASR,
|
||||||
const DisplayItemClipChain* aParent)
|
const DisplayItemClipChain* aParent,
|
||||||
|
DisplayItemClipChain* aNextClipChainToDestroy)
|
||||||
: mClip(aClip)
|
: mClip(aClip)
|
||||||
, mASR(aASR)
|
, mASR(aASR)
|
||||||
, mParent(aParent)
|
, mParent(aParent)
|
||||||
|
, mNextClipChainToDestroy(aNextClipChainToDestroy)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
, mOnStack(true)
|
, mOnStack(true)
|
||||||
#endif
|
#endif
|
||||||
|
@ -79,6 +81,7 @@ struct DisplayItemClipChain
|
||||||
|
|
||||||
DisplayItemClipChain()
|
DisplayItemClipChain()
|
||||||
: mASR(nullptr)
|
: mASR(nullptr)
|
||||||
|
, mNextClipChainToDestroy(nullptr)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
, mOnStack(true)
|
, mOnStack(true)
|
||||||
#endif
|
#endif
|
||||||
|
@ -89,6 +92,7 @@ struct DisplayItemClipChain
|
||||||
const ActiveScrolledRoot* mASR;
|
const ActiveScrolledRoot* mASR;
|
||||||
RefPtr<const DisplayItemClipChain> mParent;
|
RefPtr<const DisplayItemClipChain> mParent;
|
||||||
uint32_t mRefCount = 0;
|
uint32_t mRefCount = 0;
|
||||||
|
DisplayItemClipChain* mNextClipChainToDestroy;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
bool mOnStack;
|
bool mOnStack;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -978,6 +978,7 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
|
||||||
, mDirtyRect(-1, -1, -1, -1)
|
, mDirtyRect(-1, -1, -1, -1)
|
||||||
, mGlassDisplayItem(nullptr)
|
, mGlassDisplayItem(nullptr)
|
||||||
, mScrollInfoItemsForHoisting(nullptr)
|
, mScrollInfoItemsForHoisting(nullptr)
|
||||||
|
, mFirstClipChainToDestroy(nullptr)
|
||||||
, mActiveScrolledRootForRootScrollframe(nullptr)
|
, mActiveScrolledRootForRootScrollframe(nullptr)
|
||||||
, mMode(aMode)
|
, mMode(aMode)
|
||||||
, mCurrentScrollParentId(FrameMetrics::NULL_SCROLL_ID)
|
, mCurrentScrollParentId(FrameMetrics::NULL_SCROLL_ID)
|
||||||
|
@ -1252,8 +1253,11 @@ nsDisplayListBuilder::~nsDisplayListBuilder()
|
||||||
"All presshells should have been exited");
|
"All presshells should have been exited");
|
||||||
NS_ASSERTION(!mCurrentTableItem, "No table item should be active");
|
NS_ASSERTION(!mCurrentTableItem, "No table item should be active");
|
||||||
|
|
||||||
for (DisplayItemClipChain* c : mClipChainsToDestroy) {
|
DisplayItemClipChain* c = mFirstClipChainToDestroy;
|
||||||
|
while (c) {
|
||||||
|
DisplayItemClipChain* next = c->mNextClipChainToDestroy;
|
||||||
c->DisplayItemClipChain::~DisplayItemClipChain();
|
c->DisplayItemClipChain::~DisplayItemClipChain();
|
||||||
|
c = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_COUNT_DTOR(nsDisplayListBuilder);
|
MOZ_COUNT_DTOR(nsDisplayListBuilder);
|
||||||
|
@ -1442,18 +1446,19 @@ nsDisplayListBuilder::FreeClipChains()
|
||||||
// Iterate the clip chains from newest to oldest (forward
|
// Iterate the clip chains from newest to oldest (forward
|
||||||
// iteration), so that we destroy descendants first which
|
// iteration), so that we destroy descendants first which
|
||||||
// will drop the ref count on their ancestors.
|
// will drop the ref count on their ancestors.
|
||||||
auto it = mClipChainsToDestroy.begin();
|
DisplayItemClipChain** indirect = &mFirstClipChainToDestroy;
|
||||||
|
|
||||||
while (it != mClipChainsToDestroy.end()) {
|
while (*indirect) {
|
||||||
DisplayItemClipChain* clip = *it;
|
if (!(*indirect)->mRefCount) {
|
||||||
|
DisplayItemClipChain* next = (*indirect)->mNextClipChainToDestroy;
|
||||||
|
|
||||||
if (!clip->mRefCount) {
|
mClipDeduplicator.erase(*indirect);
|
||||||
mClipDeduplicator.erase(clip);
|
(*indirect)->DisplayItemClipChain::~DisplayItemClipChain();
|
||||||
it = mClipChainsToDestroy.erase(it);
|
Destroy(DisplayItemType::TYPE_ZERO, *indirect);
|
||||||
clip->DisplayItemClipChain::~DisplayItemClipChain();
|
|
||||||
Destroy(DisplayItemType::TYPE_ZERO, clip);
|
*indirect = next;
|
||||||
} else {
|
} else {
|
||||||
++it;
|
indirect = &(*indirect)->mNextClipChainToDestroy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1620,7 +1625,10 @@ nsDisplayListBuilder::AllocateDisplayItemClipChain(
|
||||||
MOZ_ASSERT(!(aParent && aParent->mOnStack));
|
MOZ_ASSERT(!(aParent && aParent->mOnStack));
|
||||||
void* p = Allocate(sizeof(DisplayItemClipChain), DisplayItemType::TYPE_ZERO);
|
void* p = Allocate(sizeof(DisplayItemClipChain), DisplayItemType::TYPE_ZERO);
|
||||||
DisplayItemClipChain* c =
|
DisplayItemClipChain* c =
|
||||||
new (KnownNotNull, p) DisplayItemClipChain(aClip, aASR, aParent);
|
new (KnownNotNull, p) DisplayItemClipChain(aClip,
|
||||||
|
aASR,
|
||||||
|
aParent,
|
||||||
|
mFirstClipChainToDestroy);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
c->mOnStack = false;
|
c->mOnStack = false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1635,7 +1643,7 @@ nsDisplayListBuilder::AllocateDisplayItemClipChain(
|
||||||
Destroy(DisplayItemType::TYPE_ZERO, c);
|
Destroy(DisplayItemType::TYPE_ZERO, c);
|
||||||
return *(result.first);
|
return *(result.first);
|
||||||
}
|
}
|
||||||
mClipChainsToDestroy.emplace_front(c);
|
mFirstClipChainToDestroy = c;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2122,7 +2122,7 @@ private:
|
||||||
DisplayItemClipChainHasher,
|
DisplayItemClipChainHasher,
|
||||||
DisplayItemClipChainEqualer>
|
DisplayItemClipChainEqualer>
|
||||||
mClipDeduplicator;
|
mClipDeduplicator;
|
||||||
std::list<DisplayItemClipChain*> mClipChainsToDestroy;
|
DisplayItemClipChain* mFirstClipChainToDestroy;
|
||||||
nsTArray<nsDisplayItem*> mTemporaryItems;
|
nsTArray<nsDisplayItem*> mTemporaryItems;
|
||||||
const ActiveScrolledRoot* mActiveScrolledRootForRootScrollframe;
|
const ActiveScrolledRoot* mActiveScrolledRootForRootScrollframe;
|
||||||
nsDisplayListBuilderMode mMode;
|
nsDisplayListBuilderMode mMode;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче