Bug 1161049 patch 3 - Don't send animations to a layer if we're not using off-main-thread compositing. r=mstange
authorL. David Baron <dbaron@dbaron.org>
Fri, 08 May 2015 15:56:37 +0200
changeset 274397 c33b62fc04ac93aa522ac0b55b8273447d6c8c65
parent 274396 e09370e4a89581dfba7b68c998ca0e2e76b46ff0
child 274398 5df6a8eccc53b8d27582a43ba3098e41442e89ff
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1161049, 947753
milestone40.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 1161049 patch 3 - Don't send animations to a layer if we're not using off-main-thread compositing. r=mstange This refixes bug 947753 in a way that leads to fewer complications, since we don't need to predict what kind of layer manager an element's layer will have before the layer is actually created. It has the disadvantage that AnimationPlayerCollection::CanPerformOnCompositorThread isn't really telling the truth in cases where we won't have an layer that does off-main-thread compositing. This means that we will force the creation of a layer to receive the animations (which might actually be good), although it may have some disadvantages. It also means that the additional (unlanded) patch in bug 947753 still isn't needed, since we never set the animation generation on the layer, so we will never try to throttle (suppress main thread execution) of animations.
layout/base/nsDisplayList.cpp
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -483,16 +483,23 @@ nsDisplayListBuilder::AddAnimationsAndTr
   // nsDisplay*::BuildLayer while constructing a layer (with all
   // pointers non-null), or from RestyleManager's handling of
   // UpdateOpacityLayer/UpdateTransformLayer hints.
   MOZ_ASSERT(!aBuilder == !aItem,
              "should only be called in two configurations, with both "
              "aBuilder and aItem, or with neither");
   MOZ_ASSERT(!aItem || aFrame == aItem->Frame(), "frame mismatch");
 
+  // Only send animations to a layer that is actually using
+  // off-main-thread compositing.
+  if (aLayer->Manager()->GetBackendType() !=
+        layers::LayersBackend::LAYERS_CLIENT) {
+    return;
+  }
+
   bool pending = !aBuilder;
 
   if (pending) {
     aLayer->ClearAnimationsForNextTransaction();
   } else {
     aLayer->ClearAnimations();
   }