mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-24 13:52:37 +00:00
Bug 937766, part 4 - Add GCGraph::IsEmpty method. r=smaug
This commit is contained in:
parent
625ea25bce
commit
c646a8c5ef
@ -286,6 +286,14 @@ public:
|
||||
mSentinelAndBlocks[1].block = nullptr;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool IsEmpty()
|
||||
{
|
||||
return !mSentinelAndBlocks[0].block &&
|
||||
!mSentinelAndBlocks[1].block;
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
struct Block;
|
||||
union PtrInfoOrBlock {
|
||||
@ -521,6 +529,13 @@ public:
|
||||
mLast = nullptr;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool IsEmpty()
|
||||
{
|
||||
return !mBlocks && !mLast;
|
||||
}
|
||||
#endif
|
||||
|
||||
class Builder;
|
||||
friend class Builder;
|
||||
class Builder {
|
||||
@ -678,7 +693,7 @@ public:
|
||||
|
||||
void Init()
|
||||
{
|
||||
MOZ_ASSERT(!mPtrToNodeMap.ops, "Failed to clear mPtrToNodeMap");
|
||||
MOZ_ASSERT(IsEmpty(), "Failed to call GCGraph::Clear");
|
||||
if (!PL_DHashTableInit(&mPtrToNodeMap, &PtrNodeOps, nullptr,
|
||||
sizeof(PtrToNodeEntry), 32768)) {
|
||||
MOZ_CRASH();
|
||||
@ -695,6 +710,15 @@ public:
|
||||
mPtrToNodeMap.ops = nullptr;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool IsEmpty()
|
||||
{
|
||||
return mNodes.IsEmpty() && mEdges.IsEmpty() &&
|
||||
mWeakMaps.IsEmpty() && mRootCount == 0 &&
|
||||
!mPtrToNodeMap.ops;
|
||||
}
|
||||
#endif
|
||||
|
||||
PtrInfo* FindNode(void *aPtr);
|
||||
PtrToNodeEntry* AddNodeToMap(void *aPtr);
|
||||
void RemoveNodeFromMap(void *aPtr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user