Skip to content

Commit

Permalink
Bug 1911448 - Remove DOMContentFlushed. r=smaug,perftest-reviewers,sp…
Browse files Browse the repository at this point in the history
…arky

As per comments in bug 1910411's patches and others, it's not a useful
metric, specially now that we have LCP and so on.

Actually there doesn't seem to be any consumer of it since bug 1892001.

Differential Revision: https://phabricator.services.mozilla.com/D218489
  • Loading branch information
emilio committed Aug 5, 2024
1 parent 4dd2648 commit 467b70e
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 102 deletions.
3 changes: 0 additions & 3 deletions dom/base/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8376,9 +8376,6 @@ void Document::UnblockDOMContentLoaded() {
("DOCUMENT %p UnblockDOMContentLoaded", this));

mDidFireDOMContentLoaded = true;
if (PresShell* presShell = GetPresShell()) {
presShell->GetRefreshDriver()->NotifyDOMContentLoaded();
}

MOZ_ASSERT(mReadyState == READYSTATE_INTERACTIVE);
if (!mSynchronousDOMContentLoaded) {
Expand Down
34 changes: 0 additions & 34 deletions dom/base/nsDOMNavigationTiming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,37 +488,6 @@ void nsDOMNavigationTiming::NotifyLargestContentfulRenderForRootContentDocument(
mNavigationStart + TimeDuration::FromMilliseconds(aRenderTime);
}

void nsDOMNavigationTiming::NotifyDOMContentFlushedForRootContentDocument() {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mNavigationStart.IsNull());

if (!mDOMContentFlushed.IsNull()) {
return;
}

mDOMContentFlushed = TimeStamp::Now();

if (profiler_thread_is_being_profiled_for_markers() ||
PAGELOAD_LOG_ENABLED()) {
TimeDuration elapsed = mDOMContentFlushed - mNavigationStart;
nsPrintfCString marker(
"DOMContentFlushed after %dms for URL %s, %s",
int(elapsed.ToMilliseconds()),
nsContentUtils::TruncatedURLForDisplay(mLoadedURI).get(),
mDocShellHasBeenActiveSinceNavigationStart
? "foreground tab"
: "this tab was inactive some of the time between navigation start "
"and DOMContentFlushed");
PAGELOAD_LOG(("%s", marker.get()));
PROFILER_MARKER_TEXT(
"DOMContentFlushed", DOM,
MarkerOptions(
MarkerTiming::Interval(mNavigationStart, mDOMContentFlushed),
MarkerInnerWindowIdFromDocShell(mDocShell)),
marker);
}
}

void nsDOMNavigationTiming::NotifyDocShellStateChanged(
DocShellState aDocShellState) {
mDocShellHasBeenActiveSinceNavigationStart &=
Expand Down Expand Up @@ -595,7 +564,6 @@ nsDOMNavigationTiming::nsDOMNavigationTiming(nsDocShell* aDocShell,
mNavigationStart(aOther->mNavigationStart),
mNonBlankPaint(aOther->mNonBlankPaint),
mContentfulComposite(aOther->mContentfulComposite),
mDOMContentFlushed(aOther->mDOMContentFlushed),
mBeforeUnloadStart(aOther->mBeforeUnloadStart),
mUnloadStart(aOther->mUnloadStart),
mUnloadEnd(aOther->mUnloadEnd),
Expand Down Expand Up @@ -629,7 +597,6 @@ void mozilla::ipc::IPDLParamTraits<nsDOMNavigationTiming*>::Write(
WriteIPDLParam(aWriter, aActor, aParam->mNavigationStart);
WriteIPDLParam(aWriter, aActor, aParam->mNonBlankPaint);
WriteIPDLParam(aWriter, aActor, aParam->mContentfulComposite);
WriteIPDLParam(aWriter, aActor, aParam->mDOMContentFlushed);
WriteIPDLParam(aWriter, aActor, aParam->mBeforeUnloadStart);
WriteIPDLParam(aWriter, aActor, aParam->mUnloadStart);
WriteIPDLParam(aWriter, aActor, aParam->mUnloadEnd);
Expand Down Expand Up @@ -669,7 +636,6 @@ bool mozilla::ipc::IPDLParamTraits<nsDOMNavigationTiming*>::Read(
!ReadIPDLParam(aReader, aActor, &timing->mNavigationStart) ||
!ReadIPDLParam(aReader, aActor, &timing->mNonBlankPaint) ||
!ReadIPDLParam(aReader, aActor, &timing->mContentfulComposite) ||
!ReadIPDLParam(aReader, aActor, &timing->mDOMContentFlushed) ||
!ReadIPDLParam(aReader, aActor, &timing->mBeforeUnloadStart) ||
!ReadIPDLParam(aReader, aActor, &timing->mUnloadStart) ||
!ReadIPDLParam(aReader, aActor, &timing->mUnloadEnd) ||
Expand Down
5 changes: 0 additions & 5 deletions dom/base/nsDOMNavigationTiming.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ class nsDOMNavigationTiming final : public mozilla::RelativeTimeline {
return TimeStampToDOM(mLargestContentfulRender);
}
DOMTimeMilliSec GetTimeToTTFI() const { return TimeStampToDOM(mTTFI); }
DOMTimeMilliSec GetTimeToDOMContentFlushed() const {
return TimeStampToDOM(mDOMContentFlushed);
}

DOMHighResTimeStamp GetUnloadEventStartHighRes() {
mozilla::TimeStamp stamp = GetUnloadEventStartTimeStamp();
Expand Down Expand Up @@ -182,7 +179,6 @@ class nsDOMNavigationTiming final : public mozilla::RelativeTimeline {
const mozilla::TimeStamp& aCompositeEndTime);
void NotifyLargestContentfulRenderForRootContentDocument(
const DOMHighResTimeStamp& aRenderTime);
void NotifyDOMContentFlushedForRootContentDocument();
void NotifyDocShellStateChanged(DocShellState aDocShellState);

void MaybeAddLCPProfilerMarker(mozilla::MarkerInnerWindowId aInnerWindowID);
Expand Down Expand Up @@ -243,7 +239,6 @@ class nsDOMNavigationTiming final : public mozilla::RelativeTimeline {
mozilla::TimeStamp mNonBlankPaint;
mozilla::TimeStamp mContentfulComposite;
mozilla::TimeStamp mLargestContentfulRender;
mozilla::TimeStamp mDOMContentFlushed;

mozilla::TimeStamp mBeforeUnloadStart;
mozilla::TimeStamp mUnloadStart;
Expand Down
10 changes: 0 additions & 10 deletions dom/performance/PerformanceTiming.h
Original file line number Diff line number Diff line change
Expand Up @@ -415,16 +415,6 @@ class PerformanceTiming final : public nsWrapperCache {
mPerformance->GetRTPCallerType());
}

DOMTimeMilliSec TimeToDOMContentFlushed() const {
if (!StaticPrefs::dom_enable_performance()) {
return 0;
}
return nsRFPService::ReduceTimePrecisionAsMSecs(
GetDOMTiming()->GetTimeToDOMContentFlushed(),
mPerformance->GetRandomTimelineSeed(),
mPerformance->GetRTPCallerType());
}

DOMTimeMilliSec TimeToFirstInteractive() const {
if (!StaticPrefs::dom_enable_performance()) {
return 0;
Expand Down
6 changes: 0 additions & 6 deletions dom/webidl/PerformanceTiming.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ interface PerformanceTiming {
[Pref="dom.performance.time_to_contentful_paint.enabled"]
readonly attribute unsigned long long timeToContentfulPaint;

// This is a Mozilla proprietary extension and not part of the
// performance/navigation timing specification. It marks the
// completion of the first presentation flush after DOMContentLoaded.
[Pref="dom.performance.time_to_dom_content_flushed.enabled"]
readonly attribute unsigned long long timeToDOMContentFlushed;

// This is a Chrome proprietary extension and not part of the
// performance/navigation timing specification.
// Returns 0 if a time-to-interactive measurement has not happened.
Expand Down
10 changes: 0 additions & 10 deletions layout/base/nsPresContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2869,16 +2869,6 @@ void nsPresContext::NotifyPaintStatusReset() {
mHadNonTickContentfulPaint = false;
}

void nsPresContext::NotifyDOMContentFlushed() {
NS_ENSURE_TRUE_VOID(mPresShell);
if (IsRootContentDocumentCrossProcess()) {
RefPtr<nsDOMNavigationTiming> timing = mDocument->GetNavigationTiming();
if (timing) {
timing->NotifyDOMContentFlushedForRootContentDocument();
}
}
}

nscoord nsPresContext::GfxUnitsToAppUnits(gfxFloat aGfxUnits) const {
return mDeviceContext->GfxUnitsToAppUnits(aGfxUnits);
}
Expand Down
1 change: 0 additions & 1 deletion layout/base/nsPresContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,6 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr {
void NotifyNonBlankPaint();
void NotifyContentfulPaint();
void NotifyPaintStatusReset();
void NotifyDOMContentFlushed();

bool HasEverBuiltInvisibleText() const { return mHasEverBuiltInvisibleText; }
void SetBuiltInvisibleText() { mHasEverBuiltInvisibleText = true; }
Expand Down
21 changes: 0 additions & 21 deletions layout/base/nsRefreshDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,6 @@ nsRefreshDriver::nsRefreshDriver(nsPresContext* aPresContext)
mWaitingForTransaction(false),
mSkippedPaints(false),
mResizeSuppressed(false),
mNotifyDOMContentFlushed(false),
mNeedToUpdateIntersectionObservations(false),
mNeedToUpdateResizeObservers(false),
mNeedToRunFrameRequestCallbacks(false),
Expand Down Expand Up @@ -1638,21 +1637,6 @@ void nsRefreshDriver::RemoveImageRequest(imgIRequest* aRequest) {
}
}

void nsRefreshDriver::NotifyDOMContentLoaded() {
// If the refresh driver is going to tick, we mark the timestamp after
// everything is flushed in the next tick. If it isn't, mark ourselves as
// flushed now.
if (!HasReasonsToTick()) {
if (nsPresContext* pc = GetPresContext()) {
pc->NotifyDOMContentFlushed();
}
// else, we don't have a nsPresContext, so our doc is probably being
// destroyed and this notification doesn't need sending anyway.
} else {
mNotifyDOMContentFlushed = true;
}
}

void nsRefreshDriver::RegisterCompositionPayload(
const mozilla::layers::CompositionPayload& aPayload) {
mCompositionPayloads.AppendElement(aPayload);
Expand Down Expand Up @@ -2889,11 +2873,6 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime,
static_cast<uint32_t>(totalMs));
#endif

if (mNotifyDOMContentFlushed) {
mNotifyDOMContentFlushed = false;
mPresContext->NotifyDOMContentFlushed();
}

for (nsAPostRefreshObserver* observer :
mPostRefreshObservers.ForwardRange()) {
observer->DidRefresh();
Expand Down
5 changes: 0 additions & 5 deletions layout/base/nsRefreshDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,6 @@ class nsRefreshDriver final : public mozilla::layers::TransactionIdAllocator,
static void DispatchIdleTaskAfterTickUnlessExists(mozilla::Task* aTask);
static void CancelIdleTask(mozilla::Task* aTask);

void NotifyDOMContentLoaded();

// Schedule a refresh so that any delayed events will run soon.
void RunDelayedEventsSoon();

Expand Down Expand Up @@ -636,9 +634,6 @@ class nsRefreshDriver final : public mozilla::layers::TransactionIdAllocator,
// start of every tick.
bool mResizeSuppressed : 1;

// True if the next tick should notify DOMContentFlushed.
bool mNotifyDOMContentFlushed : 1;

// True if we need to flush in order to update intersection observations in
// all our documents.
bool mNeedToUpdateIntersectionObservations : 1;
Expand Down
6 changes: 0 additions & 6 deletions modules/libpref/init/StaticPrefList.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3349,12 +3349,6 @@
value: false
mirror: always

# Is support for PerformanceTiming.timeToDOMContentFlushed enabled?
- name: dom.performance.time_to_dom_content_flushed.enabled
type: bool
value: false
mirror: always

# Is support for PerformanceTiming.timeToFirstInteractive enabled?
- name: dom.performance.time_to_first_interactive.enabled
type: bool
Expand Down
1 change: 0 additions & 1 deletion testing/profiles/raptor/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ user_pref("browser.tabs.hideStatusPanel", true);

user_pref("dom.performance.time_to_non_blank_paint.enabled", true);
user_pref("dom.performance.time_to_contentful_paint.enabled", true);
user_pref("dom.performance.time_to_dom_content_flushed.enabled", false);
user_pref("dom.performance.time_to_first_interactive.enabled", true);

// required for geckoview logging
Expand Down

0 comments on commit 467b70e

Please sign in to comment.