Title: [261029] trunk/Source/WebCore
Revision
261029
Author
[email protected]
Date
2020-05-01 15:16:59 -0700 (Fri, 01 May 2020)

Log Message

Avoid unnecessary copying in AnimationTimeline and other clean ups
https://bugs.webkit.org/show_bug.cgi?id=211309

Reviewed by Simon Fraser.

Return animations by const lvalue ref to avoid copying the Vectors.
Default the constructor and destructor implementations. Remove an
unnessary argument name from animationsForElement() and re-arrange
decls to make class definition more idiomatic.

* animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::AnimationTimeline): Deleted.
(WebCore::AnimationTimeline::~AnimationTimeline): Deleted.
* animation/AnimationTimeline.h:
(WebCore::AnimationTimeline::relevantAnimations const):
(WebCore::AnimationTimeline::allAnimations const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (261028 => 261029)


--- trunk/Source/WebCore/ChangeLog	2020-05-01 22:16:19 UTC (rev 261028)
+++ trunk/Source/WebCore/ChangeLog	2020-05-01 22:16:59 UTC (rev 261029)
@@ -1,5 +1,24 @@
 2020-05-01  Daniel Bates  <[email protected]>
 
+        Avoid unnecessary copying in AnimationTimeline and other clean ups
+        https://bugs.webkit.org/show_bug.cgi?id=211309
+
+        Reviewed by Simon Fraser.
+
+        Return animations by const lvalue ref to avoid copying the Vectors.
+        Default the constructor and destructor implementations. Remove an
+        unnessary argument name from animationsForElement() and re-arrange
+        decls to make class definition more idiomatic.
+
+        * animation/AnimationTimeline.cpp:
+        (WebCore::AnimationTimeline::AnimationTimeline): Deleted.
+        (WebCore::AnimationTimeline::~AnimationTimeline): Deleted.
+        * animation/AnimationTimeline.h:
+        (WebCore::AnimationTimeline::relevantAnimations const):
+        (WebCore::AnimationTimeline::allAnimations const):
+
+2020-05-01  Daniel Bates  <[email protected]>
+
         Change HitTestResult::NodeSet from set of RefPtrs to set of Refs
         https://bugs.webkit.org/show_bug.cgi?id=211306
 

Modified: trunk/Source/WebCore/animation/AnimationTimeline.cpp (261028 => 261029)


--- trunk/Source/WebCore/animation/AnimationTimeline.cpp	2020-05-01 22:16:19 UTC (rev 261028)
+++ trunk/Source/WebCore/animation/AnimationTimeline.cpp	2020-05-01 22:16:59 UTC (rev 261029)
@@ -47,14 +47,9 @@
 
 namespace WebCore {
 
-AnimationTimeline::AnimationTimeline()
-{
-}
+AnimationTimeline::AnimationTimeline() = default;
+AnimationTimeline::~AnimationTimeline() = default;
 
-AnimationTimeline::~AnimationTimeline()
-{
-}
-
 void AnimationTimeline::forgetAnimation(WebAnimation* animation)
 {
     m_allAnimations.removeFirst(animation);

Modified: trunk/Source/WebCore/animation/AnimationTimeline.h (261028 => 261029)


--- trunk/Source/WebCore/animation/AnimationTimeline.h	2020-05-01 22:16:19 UTC (rev 261028)
+++ trunk/Source/WebCore/animation/AnimationTimeline.h	2020-05-01 22:16:59 UTC (rev 261029)
@@ -48,10 +48,12 @@
 
 class AnimationTimeline : public RefCounted<AnimationTimeline>, public CanMakeWeakPtr<AnimationTimeline> {
 public:
+    virtual ~AnimationTimeline();
+
     virtual bool isDocumentTimeline() const { return false; }
 
-    AnimationCollection relevantAnimations() const { return m_animations; }
-    Vector<WeakPtr<WebAnimation>> allAnimations() const { return m_allAnimations; }
+    const AnimationCollection& relevantAnimations() const { return m_animations; }
+    const Vector<WeakPtr<WebAnimation>>& allAnimations() const { return m_allAnimations; }
 
     void forgetAnimation(WebAnimation*);
     virtual void animationTimingDidChange(WebAnimation&);
@@ -61,7 +63,7 @@
     virtual Optional<Seconds> currentTime() { return m_currentTime; }
 
     enum class Ordering : uint8_t { Sorted, Unsorted };
-    Vector<RefPtr<WebAnimation>> animationsForElement(Element&, Ordering ordering = Ordering::Unsorted) const;
+    Vector<RefPtr<WebAnimation>> animationsForElement(Element&, Ordering = Ordering::Unsorted) const;
 
     void elementWasRemoved(Element&);
 
@@ -76,8 +78,6 @@
     void updateCSSAnimationsForElement(Element&, const RenderStyle* currentStyle, const RenderStyle& afterChangeStyle);
     void updateCSSTransitionsForElement(Element&, const RenderStyle& currentStyle, const RenderStyle& afterChangeStyle);
 
-    virtual ~AnimationTimeline();
-
 protected:
     explicit AnimationTimeline();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to