Bug 1545474 - Part 1: Consolidate sync IPC calls inside of nsDocShell::UpdateURLAndHistory, r=peterv, r=nika for adding sync IPC messages

Inside of nsDocShell::UpdateURLAndHistory, there are 4 sync IPC calls to
nsSHistory plus 1 static call, which contains at least one nsSHEntry::GetParent
sync IPC call. All of these calls can be moved inside of a new method
EvictContentViewersOrReplaceEntry on nsSHEntry, resulting in just 1 sync IPC
call.

Differential Revision: https://phabricator.services.mozilla.com/D32729
This commit is contained in:
Anny Gakhokidze
2019-04-18 15:18:00 -04:00
parent b284d5366a
commit b30de5f1d0
8 changed files with 42 additions and 13 deletions

View File

@@ -11181,19 +11181,8 @@ nsresult nsDocShell::UpdateURLAndHistory(Document* aDocument, nsIURI* aNewURI,
// subtree that disables session history.
RefPtr<ChildSHistory> rootSH = GetRootSessionHistory();
if (rootSH) {
if (!aReplace) {
int32_t curIndex = rootSH->Index();
if (curIndex > -1) {
rootSH->LegacySHistory()->EvictOutOfRangeContentViewers(curIndex);
}
} else {
nsCOMPtr<nsISHEntry> rootSHEntry = nsSHistory::GetRootSHEntry(newSHEntry);
int32_t index = rootSH->LegacySHistory()->GetIndexOfEntry(rootSHEntry);
if (index > -1) {
rootSH->LegacySHistory()->ReplaceEntry(index, rootSHEntry);
}
}
rootSH->LegacySHistory()->EvictContentViewersOrReplaceEntry(newSHEntry,
aReplace);
}
// Step 4: If the document's URI changed, update document's URI and update