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:
@@ -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);
|
||||
}
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user