Bug 1736563 - Part 1: Use uint32_t for bfcache status flags r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D129013
This commit is contained in:
Kagami Sascha Rosylight 2021-10-28 22:19:59 +00:00
Родитель b49d7a0b90
Коммит eb885f2262
8 изменённых файлов: 17 добавлений и 17 удалений

Просмотреть файл

@ -2520,7 +2520,7 @@ bool CanonicalBrowsingContext::AllowedInBFCache(
return false;
}
uint16_t bfcacheCombo = 0;
uint32_t bfcacheCombo = 0;
if (mRestoreState) {
bfcacheCombo |= BFCacheStatus::RESTORING;
MOZ_LOG(gSHIPBFCacheLog, LogLevel::Debug, (" * during session restore"));
@ -2552,7 +2552,7 @@ bool CanonicalBrowsingContext::AllowedInBFCache(
PreOrderWalk([&](BrowsingContext* aBrowsingContext) {
WindowGlobalParent* wgp =
aBrowsingContext->Canonical()->GetCurrentWindowGlobal();
uint16_t subDocBFCacheCombo = wgp ? wgp->GetBFCacheStatus() : 0;
uint32_t subDocBFCacheCombo = wgp ? wgp->GetBFCacheStatus() : 0;
if (wgp) {
const Maybe<uint64_t>& singleChannelId = wgp->GetSingleChannelId();
if (singleChannelId.isSome()) {

Просмотреть файл

@ -6768,7 +6768,7 @@ bool nsDocShell::CanSavePresentation(uint32_t aLoadType,
// If the document does not want its presentation cached, then don't.
RefPtr<Document> doc = mScriptGlobal->GetExtantDoc();
uint16_t bfCacheCombo = 0;
uint32_t bfCacheCombo = 0;
bool canSavePresentation =
doc->CanSavePresentation(aNewRequest, bfCacheCombo, true);
MOZ_ASSERT_IF(canSavePresentation, bfCacheCombo == 0);
@ -9376,7 +9376,7 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
// before calling Stop() below.
if (mozilla::SessionHistoryInParent()) {
Document* document = GetDocument();
uint16_t flags = 0;
uint32_t flags = 0;
if (document && !document->CanSavePresentation(nullptr, flags, true)) {
// This forces some flags into the WindowGlobalParent's mBFCacheStatus,
// which we'll then use in CanonicalBrowsingContext::AllowedInBFCache,

Просмотреть файл

@ -6930,7 +6930,7 @@ void Document::DeletePresShell() {
mDesignModeSheetAdded = false;
}
void Document::DisallowBFCaching(uint16_t aStatus) {
void Document::DisallowBFCaching(uint32_t aStatus) {
NS_ASSERTION(!mBFCacheEntry, "We're already in the bfcache!");
if (!mBFCacheDisallowed) {
WindowGlobalChild* wgc = GetWindowGlobalChild();
@ -11009,7 +11009,7 @@ void Document::CollectDescendantDocuments(
}
bool Document::CanSavePresentation(nsIRequest* aNewRequest,
uint16_t& aBFCacheCombo,
uint32_t& aBFCacheCombo,
bool aIncludeSubdocuments,
bool aAllowUnloadListeners) {
bool ret = true;
@ -11164,7 +11164,7 @@ bool Document::CanSavePresentation(nsIRequest* aNewRequest,
auto entry = static_cast<SubDocMapEntry*>(iter.Get());
Document* subdoc = entry->mSubDocument;
uint16_t subDocBFCacheCombo = 0;
uint32_t subDocBFCacheCombo = 0;
// The aIgnoreRequest we were passed is only for us, so don't pass it on.
bool canCache =
subdoc ? subdoc->CanSavePresentation(nullptr, subDocBFCacheCombo,

Просмотреть файл

@ -1198,7 +1198,7 @@ class Document : public nsINode,
// Instead using this method, what you probably want is
// RemoveFromBFCacheSync() as we do in MessagePort and BroadcastChannel.
void DisallowBFCaching(uint16_t aStatus = BFCacheStatus::NOT_ALLOWED);
void DisallowBFCaching(uint32_t aStatus = BFCacheStatus::NOT_ALLOWED);
bool IsBFCachingAllowed() const { return !mBFCacheDisallowed; }
@ -2359,7 +2359,7 @@ class Document : public nsINode,
* combination is when we try to BFCache aNewRequest
*/
virtual bool CanSavePresentation(nsIRequest* aNewRequest,
uint16_t& aBFCacheCombo,
uint32_t& aBFCacheCombo,
bool aIncludeSubdocuments,
bool aAllowUnloadListeners = true);

Просмотреть файл

@ -4455,7 +4455,7 @@ mozilla::ipc::IPCResult ContentChild::RecvCanSavePresentation(
bool canSave = true;
// XXXBFCache pass the flags to telemetry.
uint16_t flags = 0;
uint32_t flags = 0;
BrowsingContext* browsingContext = aTopLevelContext.get();
browsingContext->PreOrderWalk([&](BrowsingContext* aContext) {
Document* doc = aContext->GetDocument();

Просмотреть файл

@ -188,7 +188,7 @@ parent:
// Add the flags in aOnFlags to the current BFCache status and remove the
// flags in aOffFlags from the current BFCache status. See the BFCacheStatus
// enum for the valid flags.
async UpdateBFCacheStatus(uint16_t aOnFlags, uint16_t aOffFlags);
async UpdateBFCacheStatus(uint32_t aOnFlags, uint32_t aOffFlags);
/**
* Used to notify the parent when there's a change in the number of requests

Просмотреть файл

@ -1359,7 +1359,7 @@ mozilla::ipc::IPCResult WindowGlobalParent::RecvRequestRestoreTabContent() {
return IPC_OK();
}
nsCString BFCacheStatusToString(uint16_t aFlags) {
nsCString BFCacheStatusToString(uint32_t aFlags) {
if (aFlags == 0) {
return "0"_ns;
}
@ -1396,7 +1396,7 @@ nsCString BFCacheStatusToString(uint16_t aFlags) {
}
mozilla::ipc::IPCResult WindowGlobalParent::RecvUpdateBFCacheStatus(
const uint16_t& aOnFlags, const uint16_t& aOffFlags) {
const uint32_t& aOnFlags, const uint32_t& aOffFlags) {
if (MOZ_UNLIKELY(MOZ_LOG_TEST(gSHIPBFCacheLog, LogLevel::Debug))) {
nsAutoCString uri("[no uri]");
if (mDocumentURI) {

Просмотреть файл

@ -222,7 +222,7 @@ class WindowGlobalParent final : public WindowContext,
Maybe<uint64_t> GetSingleChannelId() { return mSingleChannelId; }
uint16_t GetBFCacheStatus() { return mBFCacheStatus; }
uint32_t GetBFCacheStatus() { return mBFCacheStatus; }
protected:
already_AddRefed<JSActor> InitJSActor(JS::HandleObject aMaybeActor,
@ -292,8 +292,8 @@ class WindowGlobalParent final : public WindowContext,
mozilla::ipc::IPCResult RecvResetSessionStore(uint32_t aEpoch);
mozilla::ipc::IPCResult RecvUpdateBFCacheStatus(const uint16_t& aOnFlags,
const uint16_t& aOffFlags);
mozilla::ipc::IPCResult RecvUpdateBFCacheStatus(const uint32_t& aOnFlags,
const uint32_t& aOffFlags);
public:
mozilla::ipc::IPCResult RecvSetSingleChannelId(
@ -385,7 +385,7 @@ class WindowGlobalParent final : public WindowContext,
// subsequent ExpectPageUseCounters calls.
bool mSentPageUseCounters = false;
uint16_t mBFCacheStatus = 0;
uint32_t mBFCacheStatus = 0;
// mSingleChannelId records whether the loadgroup contains a single request
// with an id. If there is one channel in the loadgroup and it has an id then