зеркало из https://github.com/mozilla/gecko-dev.git
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 --HG-- extra : rebase_source : ad09a9061cd6fe8eb6796b2809ea191aceb3ac73 extra : source : 2cd5cd24763ff320719aedb2142a79822efd6de4 extra : histedit_source : fdc4f80cfd8807e46c2dc02e6ab82f2bd3acc391
This commit is contained in:
Родитель
be714d327f
Коммит
c43df3d447
|
@ -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
|
||||
|
|
|
@ -57,6 +57,7 @@ parent:
|
|||
sync FindEntryForBFCache(uint64_t sharedID, bool includeCurrentEntry) returns (MaybeNewPSHEntry entries, int32_t startIndex);
|
||||
sync Evict(PSHEntry[] entry);
|
||||
sync EnsureCorrectEntryAtCurrIndex(PSHEntry entry);
|
||||
sync EvictContentViewersOrReplaceEntry(nullable PSHEntry newSHEntry, bool replace);
|
||||
|
||||
async __delete__();
|
||||
};
|
||||
|
|
|
@ -282,6 +282,12 @@ SHistoryChild::EvictAllContentViewers(void) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
SHistoryChild::EvictContentViewersOrReplaceEntry(nsISHEntry* aNewSHEntry, bool aReplace) {
|
||||
SendEvictContentViewersOrReplaceEntry(
|
||||
static_cast<SHEntryChild*>(aNewSHEntry), aReplace);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
SHistoryChild::AddToExpirationTracker(nsIBFCacheEntry* aBFEntry) {
|
||||
RefPtr<SHEntryChildShared> entry = static_cast<SHEntryChildShared*>(aBFEntry);
|
||||
|
|
|
@ -139,6 +139,15 @@ bool SHistoryParent::RecvEvictAllContentViewers() {
|
|||
return NS_SUCCEEDED(mHistory->EvictAllContentViewers());
|
||||
}
|
||||
|
||||
bool SHistoryParent::RecvEvictContentViewersOrReplaceEntry(
|
||||
PSHEntryParent* aNewSHEntry, bool aReplace) {
|
||||
mHistory->EvictContentViewersOrReplaceEntry(
|
||||
aNewSHEntry ? static_cast<SHEntryParent*>(aNewSHEntry)->mEntry.get()
|
||||
: nullptr,
|
||||
aReplace);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SHistoryParent::RecvRemoveDynEntries(int32_t aIndex,
|
||||
PSHEntryParent* aEntry) {
|
||||
MOZ_ASSERT(Manager() == aEntry->Manager());
|
||||
|
|
|
@ -77,6 +77,7 @@ class SHistoryParent final : public PSHistoryParent {
|
|||
MaybeNewPSHEntry* aEntry, int32_t* aIndex);
|
||||
bool RecvEvict(nsTArray<PSHEntryParent*>&& aEntries);
|
||||
bool RecvEnsureCorrectEntryAtCurrIndex(PSHEntryParent* aEntry);
|
||||
bool RecvEvictContentViewersOrReplaceEntry(PSHEntryParent* aNewSHEntry, bool aReplace);
|
||||
|
||||
RefPtr<CanonicalBrowsingContext> mContext;
|
||||
RefPtr<LegacySHistory> mHistory;
|
||||
|
|
|
@ -262,4 +262,6 @@ interface nsISHistory: nsISupports
|
|||
void Reload(in unsigned long aReloadFlags);
|
||||
|
||||
[notxpcom] void EnsureCorrectEntryAtCurrIndex(in nsISHEntry aEntry);
|
||||
|
||||
[notxpcom] void EvictContentViewersOrReplaceEntry(in nsISHEntry aNewSHEntry, in bool aReplace);
|
||||
};
|
||||
|
|
|
@ -799,6 +799,25 @@ nsSHistory::EvictOutOfRangeContentViewers(int32_t aIndex) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
nsSHistory::EvictContentViewersOrReplaceEntry(nsISHEntry* aNewSHEntry,
|
||||
bool aReplace) {
|
||||
if (!aReplace) {
|
||||
int32_t curIndex;
|
||||
GetIndex(&curIndex);
|
||||
if (curIndex > -1) {
|
||||
EvictOutOfRangeContentViewers(curIndex);
|
||||
}
|
||||
} else {
|
||||
nsCOMPtr<nsISHEntry> rootSHEntry = nsSHistory::GetRootSHEntry(aNewSHEntry);
|
||||
|
||||
int32_t index = GetIndexOfEntry(rootSHEntry);
|
||||
if (index > -1) {
|
||||
ReplaceEntry(index, rootSHEntry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSHistory::EvictAllContentViewers() {
|
||||
// XXXbz we don't actually do a good job of evicting things as we should, so
|
||||
|
|
|
@ -838,6 +838,8 @@ description = Standing up Fission
|
|||
description = Standing up Fission
|
||||
[PSHistory::EvictAllContentViewers]
|
||||
description = Standing up Fission
|
||||
[PSHistory::EvictContentViewersOrReplaceEntry]
|
||||
description = Standing up Fission
|
||||
[PSHistory::RemoveDynEntries]
|
||||
description = Standing up Fission
|
||||
[PSHistory::RemoveEntries]
|
||||
|
|
Загрузка…
Ссылка в новой задаче