Bug 1650981 - Send TIME_TO_FIRST_INTERACTION_MS only from the top level content. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D83214
This commit is contained in:
Hiroyuki Ikezoe 2020-07-13 07:11:11 +00:00
Родитель fcfd044076
Коммит 43c6d349f1
1 изменённых файлов: 11 добавлений и 9 удалений

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

@ -1269,19 +1269,21 @@ void nsPresContext::RecordInteractionTime(InteractionType aType,
// Record the interaction time if it occurs after the first paint // Record the interaction time if it occurs after the first paint
// of the top level content document. // of the top level content document.
nsPresContext* topContentPresContext = nsPresContext* inProcessRootPresContext =
GetInProcessRootContentDocumentPresContext(); GetInProcessRootContentDocumentPresContext();
if (!topContentPresContext) { if (!inProcessRootPresContext ||
// There is no top content pres context so we don't care !inProcessRootPresContext->IsRootContentDocumentCrossProcess()) {
// about the interaction time. Record a value anyways to avoid // There is no top content pres context, or we are in a cross process
// trying to find the top content pres context in future interactions. // document so we don't care about the interaction time. Record a value
// anyways to avoid trying to find the top content pres context in future
// interactions.
interactionTime = TimeStamp::Now(); interactionTime = TimeStamp::Now();
return; return;
} }
if (topContentPresContext->mFirstNonBlankPaintTime.IsNull() || if (inProcessRootPresContext->mFirstNonBlankPaintTime.IsNull() ||
topContentPresContext->mFirstNonBlankPaintTime > aTimeStamp) { inProcessRootPresContext->mFirstNonBlankPaintTime > aTimeStamp) {
// Top content pres context has not had a non-blank paint yet // Top content pres context has not had a non-blank paint yet
// or the event timestamp is before the first non-blank paint, // or the event timestamp is before the first non-blank paint,
// so don't record interaction time. // so don't record interaction time.
@ -1301,7 +1303,7 @@ void nsPresContext::RecordInteractionTime(InteractionType aType,
interactionTime = TimeStamp::Now(); interactionTime = TimeStamp::Now();
// Only the top level content pres context reports first interaction // Only the top level content pres context reports first interaction
// time to telemetry (if it hasn't already done so). // time to telemetry (if it hasn't already done so).
if (this == topContentPresContext) { if (this == inProcessRootPresContext) {
if (Telemetry::CanRecordExtended()) { if (Telemetry::CanRecordExtended()) {
double millis = double millis =
(interactionTime - mFirstNonBlankPaintTime).ToMilliseconds(); (interactionTime - mFirstNonBlankPaintTime).ToMilliseconds();
@ -1312,7 +1314,7 @@ void nsPresContext::RecordInteractionTime(InteractionType aType,
} }
} }
} else { } else {
topContentPresContext->RecordInteractionTime(aType, aTimeStamp); inProcessRootPresContext->RecordInteractionTime(aType, aTimeStamp);
} }
} }