зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1324591 - Store the corresponding LayersId for each animation on the compositor. r=kats
Differential Revision: https://phabricator.services.mozilla.com/D75728
This commit is contained in:
Родитель
7b11dcd035
Коммит
d37f48e250
|
@ -315,8 +315,9 @@ static bool HasTransformLikeAnimations(const AnimationArray& aAnimations) {
|
|||
#endif
|
||||
|
||||
AnimationStorageData AnimationHelper::ExtractAnimations(
|
||||
const AnimationArray& aAnimations) {
|
||||
const LayersId& aLayersId, const AnimationArray& aAnimations) {
|
||||
AnimationStorageData storageData;
|
||||
storageData.mLayersId = aLayersId;
|
||||
|
||||
nsCSSPropertyID prevID = eCSSProperty_UNKNOWN;
|
||||
PropertyAnimationGroup* currData = nullptr;
|
||||
|
|
|
@ -115,7 +115,7 @@ class AnimationHelper {
|
|||
* IPC boundary into something we can readily use for sampling.
|
||||
*/
|
||||
static AnimationStorageData ExtractAnimations(
|
||||
const AnimationArray& aAnimations);
|
||||
const LayersId& aLayersId, const AnimationArray& aAnimations);
|
||||
|
||||
/**
|
||||
* Get a unique id to represent the compositor animation between child
|
||||
|
|
|
@ -81,11 +81,12 @@ void AnimationInfo::ClearAnimationsForNextTransaction() {
|
|||
}
|
||||
|
||||
void AnimationInfo::SetCompositorAnimations(
|
||||
const LayersId& aLayersId,
|
||||
const CompositorAnimations& aCompositorAnimations) {
|
||||
mCompositorAnimationsId = aCompositorAnimations.id();
|
||||
|
||||
mStorageData =
|
||||
AnimationHelper::ExtractAnimations(aCompositorAnimations.animations());
|
||||
mStorageData = AnimationHelper::ExtractAnimations(
|
||||
aLayersId, aCompositorAnimations.animations());
|
||||
}
|
||||
|
||||
bool AnimationInfo::StartPendingAnimations(const TimeStamp& aReadyTime) {
|
||||
|
|
|
@ -77,6 +77,7 @@ class AnimationInfo final {
|
|||
void ClearAnimations();
|
||||
void ClearAnimationsForNextTransaction();
|
||||
void SetCompositorAnimations(
|
||||
const LayersId& aLayersId,
|
||||
const CompositorAnimations& aCompositorAnimations);
|
||||
bool StartPendingAnimations(const TimeStamp& aReadyTime);
|
||||
void TransferMutatedFlagToLayer(Layer* aLayer);
|
||||
|
@ -91,6 +92,7 @@ class AnimationInfo final {
|
|||
const Maybe<TransformData>& GetTransformData() const {
|
||||
return mStorageData.mTransformData;
|
||||
}
|
||||
const LayersId& GetLayersId() const { return mStorageData.mLayersId; }
|
||||
bool ApplyPendingUpdatesForThisTransaction();
|
||||
bool HasTransformAnimation() const;
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "mozilla/dom/Nullable.h"
|
||||
#include "mozilla/ComputedTimingFunction.h" // for ComputedTimingFunction
|
||||
#include "mozilla/layers/LayersMessages.h" // for TransformData, etc
|
||||
#include "mozilla/layers/LayersTypes.h" // for LayersId
|
||||
#include "mozilla/TimeStamp.h" // for TimeStamp
|
||||
#include "mozilla/TimingParams.h"
|
||||
#include "X11UndefineNone.h"
|
||||
|
@ -75,6 +76,9 @@ struct AnimationStorageData {
|
|||
Maybe<TransformData> mTransformData;
|
||||
// For motion path. We cached the gfx path for optimization.
|
||||
RefPtr<gfx::Path> mCachedMotionPath;
|
||||
// This is used to communicate with the main-thread. E.g. to tell the fact
|
||||
// that this animation needs to be pre-rendered again on the main-thread, etc.
|
||||
LayersId mLayersId;
|
||||
|
||||
AnimationStorageData() = default;
|
||||
AnimationStorageData(AnimationStorageData&& aOther) = default;
|
||||
|
|
|
@ -137,12 +137,13 @@ void CompositorAnimationStorage::SetAnimatedValue(uint64_t aId,
|
|||
}
|
||||
|
||||
void CompositorAnimationStorage::SetAnimations(uint64_t aId,
|
||||
const LayersId& aLayersId,
|
||||
const AnimationArray& aValue) {
|
||||
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
|
||||
MutexAutoLock lock(mLock);
|
||||
|
||||
mAnimations[aId] = std::make_unique<AnimationStorageData>(
|
||||
AnimationHelper::ExtractAnimations(aValue));
|
||||
AnimationHelper::ExtractAnimations(aLayersId, aValue));
|
||||
|
||||
// If there is the last animated value, then we need to store the id to remove
|
||||
// the value if the new animation doesn't produce any animated data (i.e. in
|
||||
|
|
|
@ -122,7 +122,8 @@ class CompositorAnimationStorage final {
|
|||
/**
|
||||
* Set the animations based on the unique id
|
||||
*/
|
||||
void SetAnimations(uint64_t aId, const AnimationArray& aAnimations);
|
||||
void SetAnimations(uint64_t aId, const LayersId& aLayersId,
|
||||
const AnimationArray& aAnimations);
|
||||
|
||||
/**
|
||||
* Sample animation based the given timestamps and store them in this
|
||||
|
|
|
@ -187,12 +187,13 @@ Layer::Layer(LayerManager* aManager, void* aImplData)
|
|||
Layer::~Layer() = default;
|
||||
|
||||
void Layer::SetCompositorAnimations(
|
||||
const LayersId& aLayersId,
|
||||
const CompositorAnimations& aCompositorAnimations) {
|
||||
MOZ_LAYERS_LOG_IF_SHADOWABLE(
|
||||
this, ("Layer::Mutated(%p) SetCompositorAnimations with id=%" PRIu64,
|
||||
this, mAnimationInfo.GetCompositorAnimationsId()));
|
||||
|
||||
mAnimationInfo.SetCompositorAnimations(aCompositorAnimations);
|
||||
mAnimationInfo.SetCompositorAnimations(aLayersId, aCompositorAnimations);
|
||||
|
||||
Mutated();
|
||||
}
|
||||
|
|
|
@ -1254,6 +1254,7 @@ class Layer {
|
|||
// This is only called when the layer tree is updated. Do not call this from
|
||||
// layout code. To add an animation to this layer, use AddAnimation.
|
||||
void SetCompositorAnimations(
|
||||
const LayersId& aLayersId,
|
||||
const CompositorAnimations& aCompositorAnimations);
|
||||
// Go through all animations in this layer and its children and, for
|
||||
// any animations with a null start time, update their start time such
|
||||
|
@ -1468,6 +1469,9 @@ class Layer {
|
|||
const Maybe<TransformData>& GetTransformData() const {
|
||||
return mAnimationInfo.GetTransformData();
|
||||
}
|
||||
const LayersId& GetAnimationLayersId() const {
|
||||
return mAnimationInfo.GetLayersId();
|
||||
}
|
||||
|
||||
Maybe<uint64_t> GetAnimationGeneration() const {
|
||||
return mAnimationInfo.GetAnimationGeneration();
|
||||
|
|
|
@ -524,7 +524,7 @@ bool LayerTransactionParent::SetLayerAttributes(
|
|||
} else {
|
||||
layer->SetMaskLayer(nullptr);
|
||||
}
|
||||
layer->SetCompositorAnimations(common.compositorAnimations());
|
||||
layer->SetCompositorAnimations(mId, common.compositorAnimations());
|
||||
// Clean up the Animations by id in the CompositorAnimationStorage
|
||||
// if there are no active animations on the layer
|
||||
if (mAnimStorage && layer->GetCompositorAnimationsId() &&
|
||||
|
|
|
@ -154,11 +154,12 @@ void OMTASampler::SampleForTesting(const Maybe<TimeStamp>& aTestingSampleTime) {
|
|||
}
|
||||
|
||||
void OMTASampler::SetAnimations(
|
||||
uint64_t aId, const nsTArray<layers::Animation>& aAnimations) {
|
||||
uint64_t aId, const LayersId& aLayersId,
|
||||
const nsTArray<layers::Animation>& aAnimations) {
|
||||
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
|
||||
MutexAutoLock lock(mStorageLock);
|
||||
|
||||
mAnimStorage->SetAnimations(aId, aAnimations);
|
||||
mAnimStorage->SetAnimations(aId, aLayersId, aAnimations);
|
||||
}
|
||||
|
||||
bool OMTASampler::HasAnimations() const {
|
||||
|
|
|
@ -66,7 +66,7 @@ class OMTASampler final {
|
|||
*/
|
||||
void SetSampleTime(const TimeStamp& aSampleTime);
|
||||
void ResetPreviousSampleTime();
|
||||
void SetAnimations(uint64_t aId,
|
||||
void SetAnimations(uint64_t aId, const LayersId& aLayersId,
|
||||
const nsTArray<layers::Animation>& aAnimations);
|
||||
bool HasAnimations() const;
|
||||
|
||||
|
|
|
@ -1387,7 +1387,7 @@ bool WebRenderBridgeParent::ProcessWebRenderParentCommands(
|
|||
}
|
||||
if (data.animations().Length()) {
|
||||
if (RefPtr<OMTASampler> sampler = GetOMTASampler()) {
|
||||
sampler->SetAnimations(data.id(), data.animations());
|
||||
sampler->SetAnimations(data.id(), GetLayersId(), data.animations());
|
||||
const auto activeAnim = mActiveAnimations.find(data.id());
|
||||
if (activeAnim == mActiveAnimations.end()) {
|
||||
mActiveAnimations.emplace(data.id(), mWrEpoch);
|
||||
|
|
Загрузка…
Ссылка в новой задаче