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