Title: [251172] trunk/Source/WebCore
- Revision
- 251172
- Author
- simon.fra...@apple.com
- Date
- 2019-10-15 18:04:41 -0700 (Tue, 15 Oct 2019)
Log Message
WheelEventTestMonitor doesn't need to be threadsafe
https://bugs.webkit.org/show_bug.cgi?id=203012
Reviewed by Dean Jackson.
WheelEventTestMonitor is only called on the main thread, so doesn't need a lock to protect
m_deferCompletionReasons, and add main thread assertions.
* page/WheelEventTestMonitor.cpp:
(WebCore::WheelEventTestMonitor::clearAllTestDeferrals):
(WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer):
(WebCore::WheelEventTestMonitor::deferForReason):
(WebCore::WheelEventTestMonitor::removeDeferralForReason):
(WebCore::WheelEventTestMonitor::triggerTestTimerFired):
* page/WheelEventTestMonitor.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (251171 => 251172)
--- trunk/Source/WebCore/ChangeLog 2019-10-16 00:27:22 UTC (rev 251171)
+++ trunk/Source/WebCore/ChangeLog 2019-10-16 01:04:41 UTC (rev 251172)
@@ -1,3 +1,21 @@
+2019-10-15 Simon Fraser <simon.fra...@apple.com>
+
+ WheelEventTestMonitor doesn't need to be threadsafe
+ https://bugs.webkit.org/show_bug.cgi?id=203012
+
+ Reviewed by Dean Jackson.
+
+ WheelEventTestMonitor is only called on the main thread, so doesn't need a lock to protect
+ m_deferCompletionReasons, and add main thread assertions.
+
+ * page/WheelEventTestMonitor.cpp:
+ (WebCore::WheelEventTestMonitor::clearAllTestDeferrals):
+ (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer):
+ (WebCore::WheelEventTestMonitor::deferForReason):
+ (WebCore::WheelEventTestMonitor::removeDeferralForReason):
+ (WebCore::WheelEventTestMonitor::triggerTestTimerFired):
+ * page/WheelEventTestMonitor.h:
+
2019-10-15 Andres Gonzalez <andresg...@apple.com>
AX: Make AXIsolatedTree compile again
Modified: trunk/Source/WebCore/page/WheelEventTestMonitor.cpp (251171 => 251172)
--- trunk/Source/WebCore/page/WheelEventTestMonitor.cpp 2019-10-16 00:27:22 UTC (rev 251171)
+++ trunk/Source/WebCore/page/WheelEventTestMonitor.cpp 2019-10-16 01:04:41 UTC (rev 251172)
@@ -46,7 +46,7 @@
void WheelEventTestMonitor::clearAllTestDeferrals()
{
- std::lock_guard<Lock> lock(m_reasonsLock);
+ ASSERT(isMainThread());
m_deferCompletionReasons.clear();
m_completionCallback = nullptr;
m_testForCompletionTimer.stop();
@@ -55,10 +55,8 @@
void WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer(WTF::Function<void()>&& functionCallback)
{
- {
- std::lock_guard<Lock> lock(m_reasonsLock);
- m_completionCallback = WTFMove(functionCallback);
- }
+ ASSERT(isMainThread());
+ m_completionCallback = WTFMove(functionCallback);
if (!m_testForCompletionTimer.isActive())
m_testForCompletionTimer.startRepeating(1_s / 60.);
@@ -66,7 +64,7 @@
void WheelEventTestMonitor::deferForReason(ScrollableAreaIdentifier identifier, DeferReason reason)
{
- std::lock_guard<Lock> lock(m_reasonsLock);
+ ASSERT(isMainThread());
m_deferCompletionReasons.ensure(identifier, [] {
return OptionSet<DeferReason>();
}).iterator->value.add(reason);
@@ -76,7 +74,7 @@
void WheelEventTestMonitor::removeDeferralForReason(ScrollableAreaIdentifier identifier, DeferReason reason)
{
- std::lock_guard<Lock> lock(m_reasonsLock);
+ ASSERT(isMainThread());
auto it = m_deferCompletionReasons.find(identifier);
if (it == m_deferCompletionReasons.end())
return;
@@ -90,18 +88,13 @@
void WheelEventTestMonitor::triggerTestTimerFired()
{
- WTF::Function<void()> functionCallback;
-
- {
- std::lock_guard<Lock> lock(m_reasonsLock);
- if (!m_deferCompletionReasons.isEmpty()) {
- LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::triggerTestTimerFired - scrolling still active, reasons " << m_deferCompletionReasons);
- return;
- }
-
- functionCallback = WTFMove(m_completionCallback);
+ ASSERT(isMainThread());
+ if (!m_deferCompletionReasons.isEmpty()) {
+ LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::triggerTestTimerFired - scrolling still active, reasons " << m_deferCompletionReasons);
+ return;
}
+ auto functionCallback = WTFMove(m_completionCallback);
m_testForCompletionTimer.stop();
LOG_WITH_STREAM(WheelEventTestMonitor, stream << " WheelEventTestMonitor::triggerTestTimerFired: scrolling is idle, FIRING TEST");
Modified: trunk/Source/WebCore/page/WheelEventTestMonitor.h (251171 => 251172)
--- trunk/Source/WebCore/page/WheelEventTestMonitor.h 2019-10-16 00:27:22 UTC (rev 251171)
+++ trunk/Source/WebCore/page/WheelEventTestMonitor.h 2019-10-16 01:04:41 UTC (rev 251172)
@@ -65,7 +65,6 @@
WTF::Function<void()> m_completionCallback;
RunLoop::Timer<WheelEventTestMonitor> m_testForCompletionTimer;
- mutable Lock m_reasonsLock;
ScrollableAreaReasonMap m_deferCompletionReasons;
};
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes