Bug 1570255 - Reboot session history in parent part 1. r=smaug,necko-reviewers,valentin
This adds a new implementation of nsISHEntry (mozilla::dom::SessionHistoryEntry). When session history in the parent is turned on, we'll instantiate the existing nsSHistory in the parent process, but it will store entries of this new type. The nsSHistory in the child process will also be instantiated for now, to avoid breaking too many assumptions, and we try to keep parent and child implementations in sync. mozilla::dom::SessionHistoryEntry stores most of its data in a new structure (mozilla::dom::SessionHistoryInfo) which can be sent over IPC. When a load starts through the DocumentChannel we create an entry of this new type for it in the parent process in DocumentLoadListener::Open. The SessionHistoryInfo for that entry (with an associated ID) is then sent over IPC in the RedirectToRealChannelArgs to the process that does the actual load, where we store it in the nsDocShell in mLoadingEntry (and mLoadingEntryId). The parent process keeps track of outstanding loading entries in an array (mLoadingEntries) in the CanonicalBrowsingContext. When a load finishes the nsDocShell transfers mLoadingEntry into mActiveEntry, and notifies the parent process through an IPC message (HistoryCommit) with the id of that entry. The CanonicalBrowsingContext then removes the entry from the array and stores it in its mActiveEntry, and adds the entry to the nsSHistory object. There are a number of things in this patch that are broken, and a lot of FIXME comments. However, with the pref turned off things should just be working as before. The goal is to land this first part, and then iterate on the new implementation until we can switch over. Differential Revision: https://phabricator.services.mozilla.com/D65329
This commit is contained in:
@@ -64,6 +64,7 @@ namespace dom {
|
||||
class ClientInfo;
|
||||
class ClientSource;
|
||||
class EventTarget;
|
||||
class SessionHistoryInfo;
|
||||
} // namespace dom
|
||||
namespace net {
|
||||
class LoadInfo;
|
||||
@@ -1132,6 +1133,11 @@ class nsDocShell final : public nsDocLoader,
|
||||
// parent has loaded does. (This isn't the only purpose of mLSHE.)
|
||||
nsCOMPtr<nsISHEntry> mLSHE;
|
||||
|
||||
// These are only set when fission.sessionHistoryInParent is set.
|
||||
mozilla::UniquePtr<mozilla::dom::SessionHistoryInfo> mActiveEntry;
|
||||
mozilla::UniquePtr<mozilla::dom::SessionHistoryInfo> mLoadingEntry;
|
||||
uint64_t mLoadingEntryId;
|
||||
|
||||
// Holds a weak pointer to a RestorePresentationEvent object if any that
|
||||
// holds a weak pointer back to us. We use this pointer to possibly revoke
|
||||
// the event whenever necessary.
|
||||
|
||||
Reference in New Issue
Block a user