Title: [254991] trunk/Source/WebCore
- Revision
- 254991
- Author
- grao...@webkit.org
- Date
- 2020-01-23 11:23:50 -0800 (Thu, 23 Jan 2020)
Log Message
[Web Animations] Make AnimationList ref-counted
https://bugs.webkit.org/show_bug.cgi?id=206664
Reviewed by Antti Koivisto.
* platform/animation/AnimationList.cpp:
* platform/animation/AnimationList.h:
(WebCore::AnimationList::create):
(WebCore::AnimationList::copy):
(WebCore::AnimationList::AnimationList): Deleted.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::ensureAnimations):
(WebCore::RenderStyle::ensureTransitions):
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
* rendering/style/StyleRareNonInheritedData.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (254990 => 254991)
--- trunk/Source/WebCore/ChangeLog 2020-01-23 19:09:02 UTC (rev 254990)
+++ trunk/Source/WebCore/ChangeLog 2020-01-23 19:23:50 UTC (rev 254991)
@@ -1,3 +1,22 @@
+2020-01-23 Antoine Quint <grao...@apple.com>
+
+ [Web Animations] Make AnimationList ref-counted
+ https://bugs.webkit.org/show_bug.cgi?id=206664
+
+ Reviewed by Antti Koivisto.
+
+ * platform/animation/AnimationList.cpp:
+ * platform/animation/AnimationList.h:
+ (WebCore::AnimationList::create):
+ (WebCore::AnimationList::copy):
+ (WebCore::AnimationList::AnimationList): Deleted.
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::ensureAnimations):
+ (WebCore::RenderStyle::ensureTransitions):
+ * rendering/style/StyleRareNonInheritedData.cpp:
+ (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+ * rendering/style/StyleRareNonInheritedData.h:
+
2020-01-23 Alex Christensen <achristen...@webkit.org>
ContentFilter should access DocumentLoader through an interface
Modified: trunk/Source/WebCore/platform/animation/AnimationList.cpp (254990 => 254991)
--- trunk/Source/WebCore/platform/animation/AnimationList.cpp 2020-01-23 19:09:02 UTC (rev 254990)
+++ trunk/Source/WebCore/platform/animation/AnimationList.cpp 2020-01-23 19:23:50 UTC (rev 254991)
@@ -33,6 +33,8 @@
animation(i).propSet(animation(j).propGet()); \
}
+AnimationList::AnimationList() = default;
+
AnimationList::AnimationList(const AnimationList& other)
{
m_animations.reserveInitialCapacity(other.size());
Modified: trunk/Source/WebCore/platform/animation/AnimationList.h (254990 => 254991)
--- trunk/Source/WebCore/platform/animation/AnimationList.h 2020-01-23 19:09:02 UTC (rev 254990)
+++ trunk/Source/WebCore/platform/animation/AnimationList.h 2020-01-23 19:23:50 UTC (rev 254991)
@@ -25,17 +25,18 @@
#pragma once
#include "Animation.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
namespace WebCore {
-class AnimationList {
- WTF_MAKE_FAST_ALLOCATED;
+class AnimationList : public RefCounted<AnimationList> {
public:
- AnimationList() { }
- AnimationList(const AnimationList&);
- AnimationList(AnimationList&&) = default;
+ static Ref<AnimationList> create() { return adoptRef(*new AnimationList); }
+ Ref<AnimationList> copy() { return adoptRef(*new AnimationList(*this)); }
+
void fillUnsetProperties();
bool operator==(const AnimationList&) const;
bool operator!=(const AnimationList& other) const
@@ -54,8 +55,10 @@
const Animation& animation(size_t i) const { return m_animations[i].get(); }
private:
+ AnimationList();
+ AnimationList(const AnimationList&);
+
AnimationList& operator=(const AnimationList&);
- AnimationList& operator=(AnimationList&&) = default;
Vector<Ref<Animation>, 0, CrashOnOverflow, 0> m_animations;
};
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (254990 => 254991)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2020-01-23 19:09:02 UTC (rev 254990)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2020-01-23 19:23:50 UTC (rev 254991)
@@ -1661,7 +1661,7 @@
AnimationList& RenderStyle::ensureAnimations()
{
if (!m_rareNonInheritedData.access().animations)
- m_rareNonInheritedData.access().animations = makeUnique<AnimationList>();
+ m_rareNonInheritedData.access().animations = AnimationList::create();
return *m_rareNonInheritedData->animations;
}
@@ -1668,7 +1668,7 @@
AnimationList& RenderStyle::ensureTransitions()
{
if (!m_rareNonInheritedData.access().transitions)
- m_rareNonInheritedData.access().transitions = makeUnique<AnimationList>();
+ m_rareNonInheritedData.access().transitions = AnimationList::create();
return *m_rareNonInheritedData->transitions;
}
Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (254990 => 254991)
--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp 2020-01-23 19:09:02 UTC (rev 254990)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp 2020-01-23 19:23:50 UTC (rev 254991)
@@ -148,8 +148,8 @@
, boxShadow(o.boxShadow ? makeUnique<ShadowData>(*o.boxShadow) : nullptr)
, willChange(o.willChange)
, boxReflect(o.boxReflect)
- , animations(o.animations ? makeUnique<AnimationList>(*o.animations) : nullptr)
- , transitions(o.transitions ? makeUnique<AnimationList>(*o.transitions) : nullptr)
+ , animations(o.animations ? o.animations->copy() : o.animations)
+ , transitions(o.transitions ? o.transitions->copy() : o.transitions)
, mask(o.mask)
, maskBoxImage(o.maskBoxImage)
, pageSize(o.pageSize)
Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (254990 => 254991)
--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h 2020-01-23 19:09:02 UTC (rev 254990)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h 2020-01-23 19:23:50 UTC (rev 254991)
@@ -137,8 +137,8 @@
RefPtr<StyleReflection> boxReflect;
- std::unique_ptr<AnimationList> animations;
- std::unique_ptr<AnimationList> transitions;
+ RefPtr<AnimationList> animations;
+ RefPtr<AnimationList> transitions;
FillLayer mask;
NinePieceImage maskBoxImage;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes