Bug 1620690 - Fix BFCACHE_COMBO telemetry is double counted r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D141259
This commit is contained in:
Sean Feng 2022-03-17 14:59:28 +00:00
Родитель 8f495ae117
Коммит 0cd5f46306
2 изменённых файлов: 17 добавлений и 8 удалений

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

@ -6646,8 +6646,10 @@ nsresult nsDocShell::CreateAboutBlankContentViewer(
}
}
mSavingOldViewer = aTryToSaveOldPresentation &&
CanSavePresentation(LOAD_NORMAL, nullptr, nullptr);
mSavingOldViewer =
aTryToSaveOldPresentation &&
CanSavePresentation(LOAD_NORMAL, nullptr, nullptr,
/* aReportBFCacheComboTelemetry */ true);
// Make sure to blow away our mLoadingURI just in case. No loads
// from inside this pagehide.
@ -6811,7 +6813,8 @@ nsresult nsDocShell::CreateContentViewerForActor(
bool nsDocShell::CanSavePresentation(uint32_t aLoadType,
nsIRequest* aNewRequest,
Document* aNewDocument) {
Document* aNewDocument,
bool aReportBFCacheComboTelemetry) {
if (!mOSHE) {
return false; // no entry to save into
}
@ -6884,8 +6887,10 @@ bool nsDocShell::CanSavePresentation(uint32_t aLoadType,
}
}
}
ReportBFCacheComboTelemetry(bfCacheCombo);
if (aReportBFCacheComboTelemetry) {
ReportBFCacheComboTelemetry(bfCacheCombo);
}
return doc && canSavePresentation;
}
@ -7329,7 +7334,8 @@ nsresult nsDocShell::RestoreFromHistory() {
if (doc) {
request = doc->GetChannel();
}
mSavingOldViewer = CanSavePresentation(mLoadType, request, doc);
mSavingOldViewer = CanSavePresentation(
mLoadType, request, doc, /* aReportBFCacheComboTelemetry */ false);
}
// Protect against mLSHE going away via a load triggered from
@ -7822,7 +7828,8 @@ nsresult nsDocShell::CreateContentViewer(const nsACString& aContentType,
// it's still safe to do so, since there may have been DOM mutations
// or new requests initiated.
RefPtr<Document> doc = viewer->GetDocument();
mSavingOldViewer = CanSavePresentation(mLoadType, aRequest, doc);
mSavingOldViewer = CanSavePresentation(
mLoadType, aRequest, doc, /* aReportBFCacheComboTelemetry */ false);
}
NS_ASSERTION(!mLoadingURI, "Re-entering unload?");
@ -9487,7 +9494,8 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState,
// Also pass nullptr for the document, since it doesn't affect the return
// value for our purposes here.
bool savePresentation =
CanSavePresentation(aLoadState->LoadType(), nullptr, nullptr);
CanSavePresentation(aLoadState->LoadType(), nullptr, nullptr,
/* aReportBFCacheComboTelemetry */ true);
// nsDocShell::CanSavePresentation is for non-SHIP version only. Do a
// separate check for SHIP so that we know if there are ongoing requests

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

@ -888,7 +888,8 @@ class nsDocShell final : public nsDocLoader,
// has not been created yet. |aNewDocument| should be the document that will
// replace the current document.
bool CanSavePresentation(uint32_t aLoadType, nsIRequest* aNewRequest,
mozilla::dom::Document* aNewDocument);
mozilla::dom::Document* aNewDocument,
bool aReportBFCacheComboTelemetry);
static void ReportBFCacheComboTelemetry(uint32_t aCombo);