Bug 1456372 - Call AdvanceAnimations on the root WebRenderBridgeParent for RecvGetAnimationOpacity() and RecvGetAnimationTransform(). r=kats
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 01 May 2018 06:13:39 +0900
changeset 472461 3c41cb113527de184bb97f2f9c12a6d3b20d31e6
parent 472460 47e17edbd3e731e5562ac42d442dcf648d1beec3
child 472462 0cb6b7a530e2beadd4d74ae23a9c8d294691a11e
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1456372
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1456372 - Call AdvanceAnimations on the root WebRenderBridgeParent for RecvGetAnimationOpacity() and RecvGetAnimationTransform(). r=kats MozReview-Commit-ID: LmNScQ01eFJ
gfx/layers/wr/WebRenderBridgeParent.cpp
gfx/layers/wr/WebRenderBridgeParent.h
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -520,16 +520,27 @@ WebRenderBridgeParent::GetRootCompositor
   CompositorBridgeParent::LayerTreeState* lts =
       CompositorBridgeParent::GetIndirectShadowTree(GetLayersId());
   if (!lts) {
     return nullptr;
   }
   return lts->mParent;
 }
 
+RefPtr<WebRenderBridgeParent>
+WebRenderBridgeParent::GetRootWebRenderBridgeParent() const
+{
+  CompositorBridgeParent* cbp = GetRootCompositorBridgeParent();
+  if (!cbp) {
+    return nullptr;
+  }
+
+  return cbp->GetWebRenderBridgeParent();
+}
+
 void
 WebRenderBridgeParent::UpdateAPZFocusState(const FocusTarget& aFocus)
 {
   CompositorBridgeParent* cbp = GetRootCompositorBridgeParent();
   if (!cbp) {
     return;
   }
   LayersId rootLayersId = cbp->RootLayerTreeId();
@@ -1106,17 +1117,21 @@ WebRenderBridgeParent::RecvGetAnimationO
                                                float* aOpacity,
                                                bool* aHasAnimationOpacity)
 {
   if (mDestroyed) {
     return IPC_FAIL_NO_REASON(this);
   }
 
   MOZ_ASSERT(mAnimStorage);
-  AdvanceAnimations();
+  if (RefPtr<WebRenderBridgeParent> root = GetRootWebRenderBridgeParent()) {
+    root->AdvanceAnimations();
+  } else {
+    AdvanceAnimations();
+  }
 
   Maybe<float> opacity = mAnimStorage->GetAnimationOpacity(aCompositorAnimationsId);
   if (opacity) {
     *aOpacity = *opacity;
     *aHasAnimationOpacity = true;
   } else {
     *aHasAnimationOpacity = false;
   }
@@ -1127,17 +1142,21 @@ mozilla::ipc::IPCResult
 WebRenderBridgeParent::RecvGetAnimationTransform(const uint64_t& aCompositorAnimationsId,
                                                  MaybeTransform* aTransform)
 {
   if (mDestroyed) {
     return IPC_FAIL_NO_REASON(this);
   }
 
   MOZ_ASSERT(mAnimStorage);
-  AdvanceAnimations();
+  if (RefPtr<WebRenderBridgeParent> root = GetRootWebRenderBridgeParent()) {
+    root->AdvanceAnimations();
+  } else {
+    AdvanceAnimations();
+  }
 
   Maybe<Matrix4x4> transform = mAnimStorage->GetAnimationTransform(aCompositorAnimationsId);
   if (transform) {
     *aTransform = *transform;
   } else {
     *aTransform = mozilla::void_t();
   }
   return IPC_OK();
--- a/gfx/layers/wr/WebRenderBridgeParent.h
+++ b/gfx/layers/wr/WebRenderBridgeParent.h
@@ -218,16 +218,18 @@ private:
   mozilla::ipc::IPCResult HandleShutdown();
 
   void AdvanceAnimations();
   void SampleAnimations(nsTArray<wr::WrOpacityProperty>& aOpacityArray,
                         nsTArray<wr::WrTransformProperty>& aTransformArray);
 
   CompositorBridgeParent* GetRootCompositorBridgeParent() const;
 
+  RefPtr<WebRenderBridgeParent> GetRootWebRenderBridgeParent() const;
+
   // Tell APZ what the subsequent sampling's timestamp should be.
   void SetAPZSampleTime();
 
   wr::Epoch GetNextWrEpoch();
 
 private:
   struct PendingTransactionId {
     PendingTransactionId(const wr::Epoch& aEpoch, TransactionId aId, const TimeStamp& aTxnStartTime, const TimeStamp& aFwdTime)