Title: [257756] trunk/Source/WebCore
- Revision
- 257756
- Author
- [email protected]
- Date
- 2020-03-02 18:59:29 -0800 (Mon, 02 Mar 2020)
Log Message
Remove the required `LockHolder` when calling `WebAnimation::instances()`
https://bugs.webkit.org/show_bug.cgi?id=208493
Reviewed by Simon Fraser.
Since `WebAnimation`s are not accessible from `Worker`s (e.g. main thread only), there's no
reason to require that a lock be held in order to access `WebAnimation::instances()`.
* animation/WebAnimation.h:
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::WebAnimation):
(WebCore::WebAnimation::~WebAnimation):
(WebCore::WebAnimation::instancesMutex): Deleted.
* inspector/agents/InspectorAnimationAgent.cpp:
(WebCore::InspectorAnimationAgent::enable):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (257755 => 257756)
--- trunk/Source/WebCore/ChangeLog 2020-03-03 02:49:55 UTC (rev 257755)
+++ trunk/Source/WebCore/ChangeLog 2020-03-03 02:59:29 UTC (rev 257756)
@@ -1,3 +1,22 @@
+2020-03-02 Devin Rousso <[email protected]>
+
+ Remove the required `LockHolder` when calling `WebAnimation::instances()`
+ https://bugs.webkit.org/show_bug.cgi?id=208493
+
+ Reviewed by Simon Fraser.
+
+ Since `WebAnimation`s are not accessible from `Worker`s (e.g. main thread only), there's no
+ reason to require that a lock be held in order to access `WebAnimation::instances()`.
+
+ * animation/WebAnimation.h:
+ * animation/WebAnimation.cpp:
+ (WebCore::WebAnimation::WebAnimation):
+ (WebCore::WebAnimation::~WebAnimation):
+ (WebCore::WebAnimation::instancesMutex): Deleted.
+
+ * inspector/agents/InspectorAnimationAgent.cpp:
+ (WebCore::InspectorAnimationAgent::enable):
+
2020-03-02 Alan Coon <[email protected]>
Add new Mac target numbers
Modified: trunk/Source/WebCore/animation/WebAnimation.cpp (257755 => 257756)
--- trunk/Source/WebCore/animation/WebAnimation.cpp 2020-03-03 02:49:55 UTC (rev 257755)
+++ trunk/Source/WebCore/animation/WebAnimation.cpp 2020-03-03 02:59:29 UTC (rev 257756)
@@ -45,7 +45,6 @@
#include "StyledElement.h"
#include "WebAnimationUtilities.h"
#include <wtf/IsoMallocInlines.h>
-#include <wtf/Lock.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/Optional.h>
#include <wtf/text/TextStream.h>
@@ -55,22 +54,12 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(WebAnimation);
-HashSet<WebAnimation*>& WebAnimation::instances(const LockHolder&)
+HashSet<WebAnimation*>& WebAnimation::instances()
{
static NeverDestroyed<HashSet<WebAnimation*>> instances;
return instances;
}
-Lock& WebAnimation::instancesMutex()
-{
- static LazyNeverDestroyed<Lock> mutex;
- static std::once_flag initializeMutex;
- std::call_once(initializeMutex, [] {
- mutex.construct();
- });
- return mutex.get();
-}
-
Ref<WebAnimation> WebAnimation::create(Document& document, AnimationEffect* effect)
{
auto result = adoptRef(*new WebAnimation(document));
@@ -102,8 +91,7 @@
m_readyPromise->resolve(*this);
suspendIfNeeded();
- LockHolder lock(instancesMutex());
- instances(lock).add(this);
+ instances().add(this);
}
WebAnimation::~WebAnimation()
@@ -113,9 +101,8 @@
if (m_timeline)
m_timeline->forgetAnimation(this);
- LockHolder lock(instancesMutex());
- ASSERT(instances(lock).contains(this));
- instances(lock).remove(this);
+ ASSERT(instances().contains(this));
+ instances().remove(this);
}
void WebAnimation::contextDestroyed()
Modified: trunk/Source/WebCore/animation/WebAnimation.h (257755 => 257756)
--- trunk/Source/WebCore/animation/WebAnimation.h 2020-03-03 02:49:55 UTC (rev 257755)
+++ trunk/Source/WebCore/animation/WebAnimation.h 2020-03-03 02:59:29 UTC (rev 257756)
@@ -57,8 +57,7 @@
static Ref<WebAnimation> create(Document&, AnimationEffect*, AnimationTimeline*);
~WebAnimation();
- static HashSet<WebAnimation*>& instances(const LockHolder&);
- static Lock& instancesMutex();
+ static HashSet<WebAnimation*>& instances();
virtual bool isDeclarativeAnimation() const { return false; }
virtual bool isCSSAnimation() const { return false; }
Modified: trunk/Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp (257755 => 257756)
--- trunk/Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp 2020-03-03 02:49:55 UTC (rev 257755)
+++ trunk/Source/WebCore/inspector/agents/InspectorAnimationAgent.cpp 2020-03-03 02:59:29 UTC (rev 257756)
@@ -263,8 +263,7 @@
};
{
- LockHolder lock(WebAnimation::instancesMutex());
- for (auto* animation : WebAnimation::instances(lock)) {
+ for (auto* animation : WebAnimation::instances()) {
if (existsInCurrentPage(animation->scriptExecutionContext()))
bindAnimation(*animation, false);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes