Title: [239270] trunk/Source/WebCore
Revision
239270
Author
grao...@webkit.org
Date
2018-12-17 09:51:57 -0800 (Mon, 17 Dec 2018)

Log Message

[Web Animations] Remove the redundant m_scheduledMicrotask from WebAnimation
https://bugs.webkit.org/show_bug.cgi?id=192758

Reviewed by Dean Jackson.

We tracked whether we had a pending microtask twice so we remove the m_scheduledMicrotask flag as m_finishNotificationStepsMicrotaskPending
gives us enough information as it is. Additionally, we remove the scheduleMicrotaskIfNeeded() and performMicrotask() functions since there is
less bookkeeping to perform.

No new test since there is no user-observable change.

* animation/WebAnimation.cpp:
(WebCore::WebAnimation::updateFinishedState):
(WebCore::WebAnimation::scheduleMicrotaskIfNeeded): Deleted.
(WebCore::WebAnimation::performMicrotask): Deleted.
* animation/WebAnimation.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239269 => 239270)


--- trunk/Source/WebCore/ChangeLog	2018-12-17 17:49:55 UTC (rev 239269)
+++ trunk/Source/WebCore/ChangeLog	2018-12-17 17:51:57 UTC (rev 239270)
@@ -1,5 +1,24 @@
 2018-12-17  Antoine Quint  <grao...@apple.com>
 
+        [Web Animations] Remove the redundant m_scheduledMicrotask from WebAnimation
+        https://bugs.webkit.org/show_bug.cgi?id=192758
+
+        Reviewed by Dean Jackson.
+
+        We tracked whether we had a pending microtask twice so we remove the m_scheduledMicrotask flag as m_finishNotificationStepsMicrotaskPending
+        gives us enough information as it is. Additionally, we remove the scheduleMicrotaskIfNeeded() and performMicrotask() functions since there is
+        less bookkeeping to perform.
+
+        No new test since there is no user-observable change.
+
+        * animation/WebAnimation.cpp:
+        (WebCore::WebAnimation::updateFinishedState):
+        (WebCore::WebAnimation::scheduleMicrotaskIfNeeded): Deleted.
+        (WebCore::WebAnimation::performMicrotask): Deleted.
+        * animation/WebAnimation.h:
+
+2018-12-17  Antoine Quint  <grao...@apple.com>
+
         [Web Animations] Ensure we don't update an animation's finished state twice when updating animations
         https://bugs.webkit.org/show_bug.cgi?id=192757
 

Modified: trunk/Source/WebCore/animation/WebAnimation.cpp (239269 => 239270)


--- trunk/Source/WebCore/animation/WebAnimation.cpp	2018-12-17 17:49:55 UTC (rev 239269)
+++ trunk/Source/WebCore/animation/WebAnimation.cpp	2018-12-17 17:51:57 UTC (rev 239270)
@@ -773,7 +773,12 @@
             // Otherwise, if synchronously notify is false, queue a microtask to run finish notification steps for animation unless there
             // is already a microtask queued to run those steps for animation.
             m_finishNotificationStepsMicrotaskPending = true;
-            scheduleMicrotaskIfNeeded();
+            MicrotaskQueue::mainThreadQueue().append(std::make_unique<VoidMicrotask>([this, protectedThis = makeRef(*this)] () {
+                if (m_finishNotificationStepsMicrotaskPending) {
+                    m_finishNotificationStepsMicrotaskPending = false;
+                    finishNotificationSteps();
+                }
+            }));
         }
     }
 
@@ -785,27 +790,6 @@
     updateRelevance();
 }
 
-void WebAnimation::scheduleMicrotaskIfNeeded()
-{
-    if (m_scheduledMicrotask)
-        return;
-
-    m_scheduledMicrotask = true;
-    MicrotaskQueue::mainThreadQueue().append(std::make_unique<VoidMicrotask>([this, protectedThis = makeRef(*this)] () {
-        this->performMicrotask();
-    }));
-}
-
-void WebAnimation::performMicrotask()
-{
-    m_scheduledMicrotask = false;
-    if (!m_finishNotificationStepsMicrotaskPending)
-        return;
-
-    m_finishNotificationStepsMicrotaskPending = false;
-    finishNotificationSteps();
-}
-
 void WebAnimation::finishNotificationSteps()
 {
     // 3.4.14. Updating the finished state

Modified: trunk/Source/WebCore/animation/WebAnimation.h (239269 => 239270)


--- trunk/Source/WebCore/animation/WebAnimation.h	2018-12-17 17:49:55 UTC (rev 239269)
+++ trunk/Source/WebCore/animation/WebAnimation.h	2018-12-17 17:51:57 UTC (rev 239270)
@@ -143,8 +143,6 @@
     std::optional<Seconds> currentTime(RespectHoldTime) const;
     ExceptionOr<void> silentlySetCurrentTime(std::optional<Seconds>);
     void finishNotificationSteps();
-    void scheduleMicrotaskIfNeeded();
-    void performMicrotask();
     bool hasPendingPauseTask() const { return m_timeToRunPendingPauseTask != TimeToRunPendingTask::NotScheduled; }
     bool hasPendingPlayTask() const { return m_timeToRunPendingPlayTask != TimeToRunPendingTask::NotScheduled; }
     ExceptionOr<void> play(AutoRewind);
@@ -172,7 +170,6 @@
     bool m_isStopped { false };
     bool m_isSuspended { false };
     bool m_finishNotificationStepsMicrotaskPending;
-    bool m_scheduledMicrotask;
     bool m_isRelevant;
     bool m_shouldSkipUpdatingFinishedStateWhenResolving;
     UniqueRef<ReadyPromise> m_readyPromise;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to