Bug 1419851 - Part2. Handle OMTA throttle for webrender. r=kats,birtles draft
authorEthan Lin <ethlin@mozilla.com>
Sat, 25 Nov 2017 00:58:30 +0800
changeset 707308 c039a3864bb6a652cd459c9cdeeb8cfc9a999e3c
parent 707307 c771cbb1f3fbb814f5a238b259b8fdec6ce522c3
child 707309 f083aedd7e813bbc56f8f992f798f41144e1f705
push id92085
push userbmo:ethlin@mozilla.com
push dateTue, 05 Dec 2017 05:11:05 +0000
reviewerskats, birtles
bugs1419851
milestone59.0a1
Bug 1419851 - Part2. Handle OMTA throttle for webrender. r=kats,birtles MozReview-Commit-ID: 4YgqLUdE4R
dom/animation/KeyframeEffectReadOnly.cpp
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -1446,24 +1446,28 @@ KeyframeEffectReadOnly::CanThrottle() co
     if (!HasEffectiveAnimationOfProperty(record.mProperty)) {
       continue;
     }
 
     EffectSet* effectSet = EffectSet::GetEffectSet(mTarget->mElement,
                                                    mTarget->mPseudoType);
     MOZ_ASSERT(effectSet, "CanThrottle should be called on an effect "
                           "associated with a target element");
-    layers::Layer* layer =
-      FrameLayerBuilder::GetDedicatedLayer(frame, record.mLayerType);
-    // Unthrottle if the layer needs to be brought up to date
-    if (!layer ||
+    layers::AnimationInfo* animationInfo =
+            layers::AnimationInfo::GetFromFrame(frame,
+                                                record.mLayerType,
+                                                GetPresShell());
+    // Unthrottle if the animation needs to be brought up to date
+    if (!animationInfo ||
         effectSet->GetAnimationGeneration() !=
-          layer->GetAnimationGeneration()) {
+        animationInfo->GetAnimationGeneration()) {
       return false;
     }
+    // Set the animationInfo to nullptr to prevent wrong using of the pointer.
+    animationInfo = nullptr;
 
     // If this is a transform animation that affects the overflow region,
     // we should unthrottle the animation periodically.
     if (record.mProperty == eCSSProperty_transform &&
         !CanThrottleTransformChanges(*frame)) {
       return false;
     }
   }