Bug 1349808 - Add telemetry for cases when we can't run async animations due to layer size being too large. data-review=bsmedberg, r=birtles,botond,bsmedberg
MozReview-Commit-ID: 61DBw1DHbQA
This commit is contained in:
@@ -129,6 +129,11 @@ KeyframeEffect::SetTarget(const Nullable<ElementOrCSSPseudoElement>& aTarget)
|
||||
// New target is null, so fall back to distribute spacing.
|
||||
KeyframeUtils::ApplyDistributeSpacing(mKeyframes);
|
||||
}
|
||||
|
||||
// If the new target frame is also oversized we should probably record that
|
||||
// too so we have a more complete picture of the type of frame sizes we
|
||||
// encounter, hence we reset the telemetry flag here.
|
||||
mRecordedContentTooLarge = false;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "mozilla/dom/KeyframeEffectReadOnly.h"
|
||||
|
||||
#include "gfxPrefs.h"
|
||||
#include "mozilla/dom/KeyframeAnimationOptionsBinding.h"
|
||||
// For UnrestrictedDoubleOrKeyframeAnimationOptions;
|
||||
#include "mozilla/dom/CSSPseudoElement.h"
|
||||
@@ -18,6 +19,7 @@
|
||||
#include "mozilla/LookAndFeel.h" // For LookAndFeel::GetInt
|
||||
#include "mozilla/KeyframeUtils.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
#include "Layers.h" // For Layer
|
||||
#include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetStyleContextForElement
|
||||
@@ -1597,6 +1599,31 @@ KeyframeEffectReadOnly::SetPerformanceWarning(
|
||||
nsCSSPropertyID aProperty,
|
||||
const AnimationPerformanceWarning& aWarning)
|
||||
{
|
||||
if (aWarning.mType == AnimationPerformanceWarning::Type::ContentTooLarge &&
|
||||
!mRecordedContentTooLarge) {
|
||||
// ContentTooLarge stores: frameSize (w x h),
|
||||
// relativeLimit (w x h), i.e. =~ viewport size *
|
||||
// ratioLimit
|
||||
// absoluteLimit (w x h)
|
||||
MOZ_ASSERT(aWarning.mParams && aWarning.mParams->Length() >= 4,
|
||||
"ContentTooLarge warning should have at least 4 parameters");
|
||||
const nsTArray<int32_t>& params = aWarning.mParams.ref();
|
||||
uint32_t frameSize = uint32_t(params[0]) * params[1];
|
||||
float viewportRatioX = gfxPrefs::AnimationPrerenderViewportRatioLimitX();
|
||||
float viewportRatioY = gfxPrefs::AnimationPrerenderViewportRatioLimitY();
|
||||
double viewportWidth = viewportRatioX ? params[2] / viewportRatioX
|
||||
: params[2];
|
||||
double viewportHeight = viewportRatioY ? params[3] / viewportRatioY
|
||||
: params[3];
|
||||
double viewportSize = viewportWidth * viewportHeight;
|
||||
uint32_t frameToViewport = frameSize / viewportSize * 100.0;
|
||||
Telemetry::Accumulate(
|
||||
Telemetry::ASYNC_ANIMATION_CONTENT_TOO_LARGE_FRAME_SIZE, frameSize);
|
||||
Telemetry::Accumulate(
|
||||
Telemetry::ASYNC_ANIMATION_CONTENT_TOO_LARGE_PERCENTAGE, frameToViewport);
|
||||
mRecordedContentTooLarge = true;
|
||||
}
|
||||
|
||||
for (AnimationProperty& property : mProperties) {
|
||||
if (property.mProperty == aProperty &&
|
||||
(!property.mPerformanceWarning ||
|
||||
|
||||
@@ -455,6 +455,11 @@ protected:
|
||||
// (i.e. it uses the additive or accumulate composite mode).
|
||||
nsDataHashtable<nsUint32HashKey, StyleAnimationValue> mBaseStyleValues;
|
||||
|
||||
// We only want to record telemetry data for "ContentTooLarge" warnings once
|
||||
// per effect:target pair so we use this member to record if we have already
|
||||
// reported a "ContentTooLarge" warning for the current target.
|
||||
bool mRecordedContentTooLarge = false;
|
||||
|
||||
private:
|
||||
nsChangeHint mCumulativeChangeHint;
|
||||
|
||||
|
||||
@@ -137,6 +137,25 @@
|
||||
"bug_numbers": [1331139],
|
||||
"description": "For each Application Reputation lookup against both the V2 and V4 Google lists, note which version of the allow list returned a match (0 = no match, 1 = match only V2, 2 = match only V4, 3 = match both V2 and V4)"
|
||||
},
|
||||
"ASYNC_ANIMATION_CONTENT_TOO_LARGE_FRAME_SIZE": {
|
||||
"alert_emails": ["bbirtles@mozilla.com"],
|
||||
"expires_in_version": "59",
|
||||
"kind": "exponential",
|
||||
"high": 80000000,
|
||||
"n_buckets": 100,
|
||||
"bug_numbers": [1100357, 1349808],
|
||||
"description": "The number of pixels of the frame for each time we encountered a layer that was so large we decided not to run its animations on the compositor."
|
||||
},
|
||||
"ASYNC_ANIMATION_CONTENT_TOO_LARGE_PERCENTAGE": {
|
||||
"alert_emails": ["bbirtles@mozilla.com"],
|
||||
"expires_in_version": "59",
|
||||
"kind": "exponential",
|
||||
"low": 100,
|
||||
"high": 1000,
|
||||
"n_buckets": 50,
|
||||
"bug_numbers": [1100357, 1349808],
|
||||
"description": "The ratio of the frame size (in total number of pixels) to the relative limit (~viewport size plus some tolerance factor, typically 12.5% in each dimension, i.e. ~27% tolerance in total area) for each time we encountered a layer that was so large we decided not to run its animations on the compositor expressed as a percentage (e.g. 130 = frame area was 30% larger than the relative limit)"
|
||||
},
|
||||
"AUDIOSTREAM_FIRST_OPEN_MS": {
|
||||
"expires_in_version": "50",
|
||||
"kind": "exponential",
|
||||
|
||||
Reference in New Issue
Block a user