[webkit-changes] [WebKit/WebKit] 73fb99: Uncouple EventLoopTimer from SuspendableTimer

Ryosuke Niwa noreply at github.com
Tue Aug 8 14:20:58 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 73fb990c113ce068101337e9081d033d6bd8cd19
      https://github.com/WebKit/WebKit/commit/73fb990c113ce068101337e9081d033d6bd8cd19
  Author: Ryosuke Niwa <rniwa at webkit.org>
  Date:   2023-08-08 (Tue, 08 Aug 2023)

  Changed paths:
    M Source/WebCore/dom/EventLoop.cpp
    M Source/WebCore/dom/EventLoop.h
    M Source/WebCore/editing/AlternativeTextController.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
    M Source/WebCore/page/EventSource.cpp
    M Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp

  Log Message:
  -----------
  Uncouple EventLoopTimer from SuspendableTimer
https://bugs.webkit.org/show_bug.cgi?id=259903

Reviewed by Chris Dumez.

This PR makes EventLoopTimer no longer inherit from SuspendableTimer so that
scheduleTask and scheduleRepeatingTask no longer takes ScriptExecutionContext&
as an argument.

EventLoopTimer now implements the logic to suspend & resume timers on its own
based off of a similar implementation in SuspendableTimer.

The plan is for SuspendableTimer to be deleted in the near future once DOMTimer
migrates to EventLoopTimer.

This PR also fixes a bug that EventLoopTimer wasn't getting removed upon firing.

Finally, this PR also makes EventLoopTimer ref-counted so that it can keep itself
alive even if the timer was canceled while it's getting executed.

* Source/WebCore/dom/EventLoop.cpp:
(WebCore::EventLoop::scheduleTask):
(WebCore::EventLoop::cancelScheduledTask):
(WebCore::EventLoop::didExecuteScheduledTask): Added. Removes the timer from
the global hash set.
(WebCore::EventLoop::scheduleRepeatingTask):
(WebCore::EventLoop::cancelRepeatingTask):
(WebCore::EventLoopTaskGroup::markAsReadyToStop):
(WebCore::EventLoopTaskGroup::suspend):
(WebCore::EventLoopTaskGroup::resume):
(WebCore::EventLoopTaskGroup::scheduleTask):
(WebCore::EventLoopTaskGroup::didExecuteScheduledTask): Added. Removes the timer
from this group's WeakHashSet.
(WebCore::EventLoopTaskGroup::scheduleRepeatingTask):
(WebCore::EventLoopTaskGroup::didAddTimer):
(WebCore::EventLoopTaskGroup::didRemoveTimer):

* Source/WebCore/dom/EventLoop.h:
(WebCore::EventLoopTaskGroup::markAsReadyToStop): Moved to cpp file.
(WebCore::EventLoopTaskGroup::suspend): Ditto.
(WebCore::EventLoopTaskGroup::resume): Ditto.

* Source/WebCore/editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::startAlternativeTextUITimer):

* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::maybeRestoreContextSoon):

* Source/WebCore/page/EventSource.cpp:
(WebCore::EventSource::scheduleInitialConnect):
(WebCore::EventSource::scheduleReconnect):

* Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp:
(WebCore::XMLHttpRequestProgressEventThrottle::updateProgress):

Canonical link: https://commits.webkit.org/266699@main




More information about the webkit-changes mailing list