Bug 1512678 - Simplify handling of previousBaseStyles in KeyframeEffect::EnsureBaseStyles; r=hiro
authorBrian Birtles <birtles@gmail.com>
Fri, 07 Dec 2018 17:28:29 +0000
changeset 508837 ae37561c3bf7cc9b83c4f5aad5cf4e28ed2e332c
parent 508836 9b7e80071dec2a9f5a06bcafac336c98fdf86951
child 508838 52d8651b683dfcf944e72114a8a41878ce7d6c15
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1512678
milestone65.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 1512678 - Simplify handling of previousBaseStyles in KeyframeEffect::EnsureBaseStyles; r=hiro This should avoid a sometimes unnecessary heaps allocation and also avoids the possibility of having a "none" previousBaseStyles. Differential Revision: https://phabricator.services.mozilla.com/D13984
dom/animation/KeyframeEffect.cpp
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -369,19 +369,19 @@ void KeyframeEffect::EnsureBaseStyles(
   if (aBaseStylesChanged != nullptr) {
     *aBaseStylesChanged = false;
   }
 
   if (!mTarget) {
     return;
   }
 
-  Maybe<BaseValuesHashmap> previousBaseStyles;
+  BaseValuesHashmap previousBaseStyles;
   if (aBaseStylesChanged != nullptr) {
-    previousBaseStyles.emplace(std::move(mBaseValues));
+    previousBaseStyles = std::move(mBaseValues);
   }
 
   mBaseValues.Clear();
 
   nsPresContext* presContext =
       nsContentUtils::GetContextForContent(mTarget->mElement);
   // If |aProperties| is empty we're not going to dereference |presContext| so
   // we don't care if it is nullptr.
@@ -400,17 +400,17 @@ void KeyframeEffect::EnsureBaseStyles(
   RefPtr<ComputedStyle> baseComputedStyle;
   for (const AnimationProperty& property : aProperties) {
     EnsureBaseStyle(property, presContext, aComputedValues, baseComputedStyle);
   }
 
   if (aBaseStylesChanged != nullptr) {
     for (auto iter = mBaseValues.Iter(); !iter.Done(); iter.Next()) {
       if (AnimationValue(iter.Data()) !=
-          AnimationValue(previousBaseStyles->Get(iter.Key()))) {
+          AnimationValue(previousBaseStyles.Get(iter.Key()))) {
         *aBaseStylesChanged = true;
         break;
       }
     }
   }
 }
 
 void KeyframeEffect::EnsureBaseStyle(