зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1506976 - Make FirstContentfulPaint timing measure until the composite end of the paint. r=bas
Differential Revision: https://phabricator.services.mozilla.com/D18880 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
5b64219bba
Коммит
f3d9f254c8
|
@ -414,7 +414,8 @@ void nsDOMNavigationTiming::NotifyNonBlankPaintForRootContentDocument() {
|
|||
}
|
||||
}
|
||||
|
||||
void nsDOMNavigationTiming::NotifyContentfulPaintForRootContentDocument() {
|
||||
void nsDOMNavigationTiming::NotifyContentfulPaintForRootContentDocument(
|
||||
const mozilla::TimeStamp& aCompositeEndTime) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(!mNavigationStart.IsNull());
|
||||
|
||||
|
@ -422,7 +423,7 @@ void nsDOMNavigationTiming::NotifyContentfulPaintForRootContentDocument() {
|
|||
return;
|
||||
}
|
||||
|
||||
mContentfulPaint = TimeStamp::Now();
|
||||
mContentfulPaint = aCompositeEndTime;
|
||||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
if (profiler_is_active() || PAGELOAD_LOG_ENABLED()) {
|
||||
|
|
|
@ -142,7 +142,8 @@ class nsDOMNavigationTiming final : public mozilla::RelativeTimeline {
|
|||
|
||||
void NotifyLongTask(mozilla::TimeStamp aWhen);
|
||||
void NotifyNonBlankPaintForRootContentDocument();
|
||||
void NotifyContentfulPaintForRootContentDocument();
|
||||
void NotifyContentfulPaintForRootContentDocument(
|
||||
const mozilla::TimeStamp& aCompositeEndTime);
|
||||
void NotifyDOMContentFlushedForRootContentDocument();
|
||||
void NotifyDocShellStateChanged(DocShellState aDocShellState);
|
||||
|
||||
|
|
|
@ -232,7 +232,8 @@ nsPresContext::nsPresContext(dom::Document* aDocument, nsPresContextType aType)
|
|||
mQuirkSheetAdded(false),
|
||||
mNeedsPrefUpdate(false),
|
||||
mHadNonBlankPaint(false),
|
||||
mHadContentfulPaint(false)
|
||||
mHadContentfulPaint(false),
|
||||
mHadContentfulPaintComposite(false)
|
||||
#ifdef DEBUG
|
||||
,
|
||||
mInitialized(false)
|
||||
|
@ -2265,6 +2266,16 @@ void nsPresContext::NotifyRevokingDidPaint(TransactionId aTransactionId) {
|
|||
|
||||
void nsPresContext::NotifyDidPaintForSubtree(
|
||||
TransactionId aTransactionId, const mozilla::TimeStamp& aTimeStamp) {
|
||||
if (mFirstContentfulPaintTransactionId && !mHadContentfulPaintComposite) {
|
||||
if (aTransactionId >= *mFirstContentfulPaintTransactionId) {
|
||||
mHadContentfulPaintComposite = true;
|
||||
RefPtr<nsDOMNavigationTiming> timing = mDocument->GetNavigationTiming();
|
||||
if (timing) {
|
||||
timing->NotifyContentfulPaintForRootContentDocument(aTimeStamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (IsRoot() && mTransactions.IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -2545,12 +2556,10 @@ void nsPresContext::NotifyContentfulPaint() {
|
|||
if (!mHadContentfulPaint) {
|
||||
mHadContentfulPaint = true;
|
||||
if (IsRootContentDocument()) {
|
||||
RefPtr<nsDOMNavigationTiming> timing = mDocument->GetNavigationTiming();
|
||||
if (timing) {
|
||||
timing->NotifyContentfulPaintForRootContentDocument();
|
||||
if (nsRootPresContext* rootPresContext = GetRootPresContext()) {
|
||||
mFirstContentfulPaintTransactionId =
|
||||
Some(rootPresContext->mRefreshDriver->LastTransactionId().Next());
|
||||
}
|
||||
|
||||
mFirstContentfulPaintTime = TimeStamp::Now();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1265,14 +1265,16 @@ class nsPresContext : public nsISupports,
|
|||
|
||||
mozilla::TimeStamp mReflowStartTime;
|
||||
|
||||
mozilla::Maybe<TransactionId> mFirstContentfulPaintTransactionId;
|
||||
|
||||
// Time of various first interaction types, used to report time from
|
||||
// first paint of the top level content pres shell to first interaction.
|
||||
mozilla::TimeStamp mFirstNonBlankPaintTime;
|
||||
mozilla::TimeStamp mFirstContentfulPaintTime;
|
||||
mozilla::TimeStamp mFirstClickTime;
|
||||
mozilla::TimeStamp mFirstKeyTime;
|
||||
mozilla::TimeStamp mFirstMouseMoveTime;
|
||||
mozilla::TimeStamp mFirstScrollTime;
|
||||
|
||||
bool mInteractionTimeEnabled;
|
||||
|
||||
// last time we did a full style flush
|
||||
|
@ -1346,6 +1348,8 @@ class nsPresContext : public nsISupports,
|
|||
unsigned mHadNonBlankPaint : 1;
|
||||
// Has NotifyContentfulPaint been called on this PresContext?
|
||||
unsigned mHadContentfulPaint : 1;
|
||||
// Has NotifyDidPaintForSubtree been called for a contentful paint?
|
||||
unsigned mHadContentfulPaintComposite : 1;
|
||||
|
||||
#ifdef DEBUG
|
||||
unsigned mInitialized : 1;
|
||||
|
|
Загрузка…
Ссылка в новой задаче