Bug 1536471 - Consolidate calls to nsISHEntry::GetChildAt in nsDocShell::ClearFrameHistory by adding a new sync IPC call nsISHistory::RemoveFrameEntries, r=peterv, r=nika for adding sync IPC messages

Currently, nsDocShell repeatedly calls nsISHEntry::GetChildAt, which
results in as many IPC sync calls as the number of children
a session history entry has. Calling nsISHEntry::GetChildCount and
ChildSHistory::Index and incurs additional extra 2 sync IPC calls.

With the proposed solution, there will only be 1 sync IPC call.

Differential Revision: https://phabricator.services.mozilla.com/D24980
This commit is contained in:
Anny Gakhokidze
2019-03-22 15:45:38 -04:00
parent b0b8cb0c1c
commit 90b0f601c4
8 changed files with 39 additions and 11 deletions

View File

@@ -3587,17 +3587,7 @@ void nsDocShell::ClearFrameHistory(nsISHEntry* aEntry) {
return;
}
int32_t count = aEntry->GetChildCount();
AutoTArray<nsID, 16> ids;
for (int32_t i = 0; i < count; ++i) {
nsCOMPtr<nsISHEntry> child;
aEntry->GetChildAt(i, getter_AddRefs(child));
if (child) {
child->GetDocshellID(*ids.AppendElement());
}
}
int32_t index = rootSH->Index();
rootSH->LegacySHistory()->RemoveEntries(ids, index);
rootSH->LegacySHistory()->RemoveFrameEntries(aEntry);
}
//-------------------------------------