Bug 1626165 - Part 1: Use move for aAnimationValues in StoreAnimatedValue(). r=layout-reviewers,firefox-animation-reviewers,hiro

We will store the sampled animations (for transforms) in AnimatedValue.
So let's change the API to move this array, and so we can just move it
into AnimationTransform in the following patch.

No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D209888
This commit is contained in:
Boris Chiou
2024-06-26 21:33:09 +00:00
parent 58505ec331
commit 6d7ad82c07
4 changed files with 16 additions and 14 deletions

View File

@@ -317,7 +317,7 @@ AnimationHelper::SampleResult AnimationHelper::SampleAnimationForEachNode(
const MutexAutoLock& aProofOfMapLock, TimeStamp aPreviousFrameTime,
TimeStamp aCurrentFrameTime, const AnimatedValue* aPreviousValue,
nsTArray<PropertyAnimationGroup>& aPropertyAnimationGroups,
nsTArray<RefPtr<StyleAnimationValue>>& aAnimationValues /* out */) {
SampledAnimationArray& aAnimationValues /* output */) {
MOZ_ASSERT(!aPropertyAnimationGroups.IsEmpty(),
"Should be called with animation data");
MOZ_ASSERT(aAnimationValues.IsEmpty(),
@@ -600,8 +600,8 @@ uint64_t AnimationHelper::GetNextCompositorAnimationsId() {
}
gfx::Matrix4x4 AnimationHelper::ServoAnimationValueToMatrix4x4(
const nsTArray<RefPtr<StyleAnimationValue>>& aValues,
const TransformData& aTransformData, gfx::Path* aCachedMotionPath) {
const SampledAnimationArray& aValues, const TransformData& aTransformData,
gfx::Path* aCachedMotionPath) {
using nsStyleTransformMatrix::TransformReferenceBox;
// This is a bit silly just to avoid the transform list copy from the

View File

@@ -23,7 +23,8 @@ class APZSampler;
class CompositorAnimationStorage;
struct AnimatedValue;
typedef nsTArray<layers::Animation> AnimationArray;
using AnimationArray = nsTArray<layers::Animation>;
using SampledAnimationArray = AutoTArray<RefPtr<StyleAnimationValue>, 1>;
/**
* This utility class allows reusing code between the webrender and
@@ -100,7 +101,7 @@ class AnimationHelper {
const MutexAutoLock& aProofOfMapLock, TimeStamp aPreviousFrameTime,
TimeStamp aCurrentFrameTime, const AnimatedValue* aPreviousValue,
nsTArray<PropertyAnimationGroup>& aPropertyAnimationGroups,
nsTArray<RefPtr<StyleAnimationValue>>& aAnimationValues);
SampledAnimationArray& aAnimationValues /* output */);
/**
* Extract organized animation data by property into an array of
@@ -161,8 +162,8 @@ class AnimationHelper {
* (e.g. transform, translate etc.).
*/
static gfx::Matrix4x4 ServoAnimationValueToMatrix4x4(
const nsTArray<RefPtr<StyleAnimationValue>>& aValue,
const TransformData& aTransformData, gfx::Path* aCachedMotionPath);
const SampledAnimationArray& aValue, const TransformData& aTransformData,
gfx::Path* aCachedMotionPath);
/**
* Returns true if |aPrerenderedRect| transformed by |aTransform| were

View File

@@ -206,7 +206,7 @@ static ParentLayerRect GetClipRectForPartialPrerender(
void CompositorAnimationStorage::StoreAnimatedValue(
nsCSSPropertyID aProperty, uint64_t aId,
const std::unique_ptr<AnimationStorageData>& aAnimationStorageData,
const AutoTArray<RefPtr<StyleAnimationValue>, 1>& aAnimationValues,
SampledAnimationArray&& aAnimationValues,
const MutexAutoLock& aProofOfMapLock, const RefPtr<APZSampler>& aApzSampler,
AnimatedValue* aAnimatedValueEntry,
JankedAnimationMap& aJankedAnimationMap) {
@@ -311,7 +311,7 @@ bool CompositorAnimationStorage::SampleAnimations(
const nsCSSPropertyID lastPropertyAnimationGroupProperty =
animationStorageData->mAnimation.LastElement().mProperty;
isAnimating = true;
AutoTArray<RefPtr<StyleAnimationValue>, 1> animationValues;
SampledAnimationArray animationValues;
AnimatedValue* previousValue = GetAnimatedValue(iter.first);
AnimationHelper::SampleResult sampleResult =
AnimationHelper::SampleAnimationForEachNode(
@@ -364,7 +364,7 @@ bool CompositorAnimationStorage::SampleAnimations(
// For the 2nd case, we store the base styles until we have some other
// new sampled results or the new animations arrived (i.e. case 1).
StoreAnimatedValue(lastPropertyAnimationGroupProperty, iter.first,
animationStorageData, animationValues,
animationStorageData, std::move(animationValues),
aProofOfMapLock, apzSampler, previousValue,
janked);
}
@@ -373,8 +373,8 @@ bool CompositorAnimationStorage::SampleAnimations(
// Store the normal sampled result.
StoreAnimatedValue(lastPropertyAnimationGroupProperty, iter.first,
animationStorageData, animationValues, aProofOfMapLock,
apzSampler, previousValue, janked);
animationStorageData, std::move(animationValues),
aProofOfMapLock, apzSampler, previousValue, janked);
}
};

View File

@@ -24,7 +24,8 @@ class Animation;
class CompositorBridgeParent;
class OMTAController;
typedef nsTArray<layers::Animation> AnimationArray;
using AnimationArray = nsTArray<layers::Animation>;
using SampledAnimationArray = AutoTArray<RefPtr<StyleAnimationValue>, 1>;
struct AnimationTransform {
/*
@@ -193,7 +194,7 @@ class CompositorAnimationStorage final {
void StoreAnimatedValue(
nsCSSPropertyID aProperty, uint64_t aId,
const std::unique_ptr<AnimationStorageData>& aAnimationStorageData,
const AutoTArray<RefPtr<StyleAnimationValue>, 1>& aAnimationValues,
SampledAnimationArray&& aAnimationValues,
const MutexAutoLock& aProofOfMapLock,
const RefPtr<APZSampler>& aApzSampler, AnimatedValue* aAnimatedValueEntry,
JankedAnimationMap& aJankedAnimationMap);