Bug 1454324 - Clear all animation data when we release layer. r=kats
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 24 Apr 2018 09:27:54 +0900
changeset 468766 ddd9936f539db24ec4445cbf38b015fb3f1f9777
parent 468765 a31d1d7403d7ffbc0f93e0573afadc6bc0702b0a
child 468767 6ba049b00c55f30638773a36e702e4144f23c8e5
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1454324
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 1454324 - Clear all animation data when we release layer. r=kats MozReview-Commit-ID: AOGNjLesY0t
gfx/layers/Layers.cpp
gfx/layers/Layers.h
gfx/layers/ipc/LayerTransactionParent.cpp
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -208,16 +208,27 @@ Layer::SetCompositorAnimations(const Com
     this, ("Layer::Mutated(%p) SetCompositorAnimations with id=%" PRIu64, this, mAnimationInfo.GetCompositorAnimationsId()));
 
   mAnimationInfo.SetCompositorAnimations(aCompositorAnimations);
 
   Mutated();
 }
 
 void
+Layer::ClearCompositorAnimations()
+{
+  MOZ_LAYERS_LOG_IF_SHADOWABLE(
+    this, ("Layer::Mutated(%p) ClearCompositorAnimations with id=%" PRIu64, this, mAnimationInfo.GetCompositorAnimationsId()));
+
+  mAnimationInfo.ClearAnimations();
+
+  Mutated();
+}
+
+void
 Layer::StartPendingAnimations(const TimeStamp& aReadyTime)
 {
   ForEachNode<ForwardIterator>(
       this,
       [&aReadyTime](Layer *layer)
       {
         if (layer->mAnimationInfo.StartPendingAnimations(aReadyTime)) {
           layer->Mutated();
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -1204,16 +1204,18 @@ public:
   // layout code.  To add an animation to this layer, use AddAnimation.
   void SetCompositorAnimations(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
   // that at |aReadyTime| the animation's current time corresponds to its
   // 'initial current time' value.
   void StartPendingAnimations(const TimeStamp& aReadyTime);
 
+  void ClearCompositorAnimations();
+
   /**
    * CONSTRUCTION PHASE ONLY
    * If a layer represents a fixed position element, this data is stored on the
    * layer for use by the compositor.
    *
    *   - |aScrollId| identifies the scroll frame that this element is fixed
    *     with respect to.
    *
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -974,16 +974,17 @@ LayerTransactionParent::RecvReleaseLayer
 {
   RefPtr<Layer> layer;
   if (!aHandle || !mLayerMap.Remove(aHandle.Value(), getter_AddRefs(layer))) {
     return IPC_FAIL_NO_REASON(this);
   }
   if (mAnimStorage &&
       layer->GetCompositorAnimationsId()) {
     mAnimStorage->ClearById(layer->GetCompositorAnimationsId());
+    layer->ClearCompositorAnimations();
   }
   layer->Disconnect();
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 LayerTransactionParent::RecvReleaseCompositable(const CompositableHandle& aHandle)
 {