Title: [169333] trunk/Source/WebCore
Revision
169333
Author
[email protected]
Date
2014-05-26 02:26:51 -0700 (Mon, 26 May 2014)

Log Message

Remove Vector copies in ShorthandPropertyWrapper implementation and use
https://bugs.webkit.org/show_bug.cgi?id=133265

Reviewed by Simon Fraser.

* page/animation/CSSPropertyAnimation.cpp:
(WebCore::ShorthandPropertyWrapper::ShorthandPropertyWrapper): Move the passed-in Vector
into the member variable instead of using Vector<>::swap().
(WebCore::ShorthandPropertyWrapper::propertyWrappers): Return a const reference of the member
variable instead of a const value.
(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): Move the Vector
object into the ShorthandProperthyWrapper constructor.
(WebCore::gatherEnclosingShorthandProperties): Deploy a range-based for-loop.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (169332 => 169333)


--- trunk/Source/WebCore/ChangeLog	2014-05-26 09:22:39 UTC (rev 169332)
+++ trunk/Source/WebCore/ChangeLog	2014-05-26 09:26:51 UTC (rev 169333)
@@ -1,3 +1,19 @@
+2014-05-26  Zan Dobersek  <[email protected]>
+
+        Remove Vector copies in ShorthandPropertyWrapper implementation and use
+        https://bugs.webkit.org/show_bug.cgi?id=133265
+
+        Reviewed by Simon Fraser.
+
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::ShorthandPropertyWrapper::ShorthandPropertyWrapper): Move the passed-in Vector
+        into the member variable instead of using Vector<>::swap().
+        (WebCore::ShorthandPropertyWrapper::propertyWrappers): Return a const reference of the member
+        variable instead of a const value.
+        (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): Move the Vector
+        object into the ShorthandProperthyWrapper constructor.
+        (WebCore::gatherEnclosingShorthandProperties): Deploy a range-based for-loop.
+
 2014-05-26  Tanay C  <[email protected]>
 
         [EFL] Fix build error in blob.cpp after r168435

Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (169332 => 169333)


--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2014-05-26 09:22:39 UTC (rev 169332)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp	2014-05-26 09:26:51 UTC (rev 169333)
@@ -960,8 +960,8 @@
 public:
     ShorthandPropertyWrapper(CSSPropertyID property, Vector<AnimationPropertyWrapperBase*> longhandWrappers)
         : AnimationPropertyWrapperBase(property)
+        , m_propertyWrappers(std::move(longhandWrappers))
     {
-        m_propertyWrappers.swap(longhandWrappers);
     }
 
     virtual bool isShorthandWrapper() const { return true; }
@@ -983,7 +983,7 @@
             (*it)->blend(anim, dst, a, b, progress);
     }
 
-    const Vector<AnimationPropertyWrapperBase*> propertyWrappers() const { return m_propertyWrappers; }
+    const Vector<AnimationPropertyWrapperBase*>& propertyWrappers() const { return m_propertyWrappers; }
 
 private:
     Vector<AnimationPropertyWrapperBase*> m_propertyWrappers;
@@ -1335,7 +1335,7 @@
             longhandWrappers.uncheckedAppend(m_propertyWrappers[wrapperIndex].get());
         }
 
-        m_propertyWrappers.uncheckedAppend(std::make_unique<ShorthandPropertyWrapper>(propertyID, longhandWrappers));
+        m_propertyWrappers.uncheckedAppend(std::make_unique<ShorthandPropertyWrapper>(propertyID, std::move(longhandWrappers)));
         indexFromPropertyID(propertyID) = animatableLonghandPropertiesCount + i;
     }
 }
@@ -1346,11 +1346,8 @@
         return false;
 
     ShorthandPropertyWrapper* shorthandWrapper = static_cast<ShorthandPropertyWrapper*>(wrapper);
-
     bool contained = false;
-    for (size_t i = 0; i < shorthandWrapper->propertyWrappers().size(); ++i) {
-        AnimationPropertyWrapperBase* currWrapper = shorthandWrapper->propertyWrappers()[i];
-
+    for (auto& currWrapper : shorthandWrapper->propertyWrappers()) {
         if (gatherEnclosingShorthandProperties(property, currWrapper, propertySet) || currWrapper->property() == property)
             contained = true;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to