Bug 1455841 - Don't update mPreviousFrameTimeStamp in the case of testing refresh mode. r?kats
On the testing refresh mode, we shouldn't update mPreviousFrameTimeStamp and
don't need to use it since there shouldn't have any time difference between
compositor time stamp and main-thread time stamp on the testing mode.
MozReview-Commit-ID: FCcyEcFhmU
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -1160,34 +1160,42 @@ void
WebRenderBridgeParent::ActorDestroy(ActorDestroyReason aWhy)
{
Destroy();
}
void
WebRenderBridgeParent::AdvanceAnimations()
{
- Maybe<TimeStamp> testingTimeStamp;
if (CompositorBridgeParent* cbp = GetRootCompositorBridgeParent()) {
- testingTimeStamp = cbp->GetTestingTimeStamp();
+ Maybe<TimeStamp> testingTimeStamp = cbp->GetTestingTimeStamp();
+ if (testingTimeStamp) {
+ // If we are on testing refresh mode, use the testing time stamp. And
+ // also we don't update mPreviousFrameTimeStamp since unlike normal
+ // refresh mode, on the testing mode animations on the compositor are
+ // synchronously composed, so we don't need to worry about the time gap
+ // between the main thread and compositor thread.
+ AnimationHelper::SampleAnimations(mAnimStorage, *testingTimeStamp);
+ return;
+ }
}
- TimeStamp animTime = testingTimeStamp.valueOr(
- !mPreviousFrameTimeStamp.IsNull()
- ? mPreviousFrameTimeStamp
- : mCompositorScheduler->GetLastComposeTime());
-
-
- AnimationHelper::SampleAnimations(mAnimStorage, animTime);
+ TimeStamp lastComposeTime = mCompositorScheduler->GetLastComposeTime();
+ // if we have already mPreviousTimeStamp, use it since on the compositor the
+ // time in the previous tick is more closer to the main-thread tick time.
+ AnimationHelper::SampleAnimations(mAnimStorage,
+ !mPreviousFrameTimeStamp.IsNull()
+ ? mPreviousFrameTimeStamp
+ : lastComposeTime);
// Reset the previous time stamp if we don't already have any running
// animations to avoid using the time which is far behind for newly
// started animations.
mPreviousFrameTimeStamp =
- mAnimStorage->AnimatedValueCount() ? animTime : TimeStamp();
+ mAnimStorage->AnimatedValueCount() ? lastComposeTime : TimeStamp();
}
void
WebRenderBridgeParent::SampleAnimations(nsTArray<wr::WrOpacityProperty>& aOpacityArray,
nsTArray<wr::WrTransformProperty>& aTransformArray)
{
AdvanceAnimations();