зеркало из https://github.com/mozilla/gecko-dev.git
Bug 893242 - Part 3: Add ContentParent::GetAllEvenIfDead(). r=bent
To do this, we got rid of the explicit removal of a ContentParent from sContentParents in MarkAsDead(). Instead, we rely on LinkedListElement's destructor to remove the ContentParent from sContentParents. Thus, a ContentParent stays in sContentParents until it's destructed. ContentParent::GetAll() checks whether the ContentParent is still alive, so its behavior is unchanged.
This commit is contained in:
Родитель
21412f80a2
Коммит
545d682d16
|
@ -519,6 +519,23 @@ ContentParent::GetAll(nsTArray<ContentParent*>& aArray)
|
|||
return;
|
||||
}
|
||||
|
||||
for (ContentParent* cp = sContentParents->getFirst(); cp;
|
||||
cp = cp->getNext()) {
|
||||
if (cp->mIsAlive) {
|
||||
aArray.AppendElement(cp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ContentParent::GetAllEvenIfDead(nsTArray<ContentParent*>& aArray)
|
||||
{
|
||||
aArray.Clear();
|
||||
|
||||
if (!sContentParents) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ContentParent* cp = sContentParents->getFirst(); cp;
|
||||
cp = cp->getNext()) {
|
||||
aArray.AppendElement(cp);
|
||||
|
@ -788,11 +805,6 @@ ContentParent::MarkAsDead()
|
|||
}
|
||||
|
||||
mIsAlive = false;
|
||||
|
||||
// Remove from sContentParents.
|
||||
if (isInList()) {
|
||||
remove();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -106,6 +106,7 @@ public:
|
|||
nsIDOMElement* aFrameElement);
|
||||
|
||||
static void GetAll(nsTArray<ContentParent*>& aArray);
|
||||
static void GetAllEvenIfDead(nsTArray<ContentParent*>& aArray);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
|
Загрузка…
Ссылка в новой задаче