Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c408a82764d20985bb78dbc1b4847bfa9eb5dad9
      
https://github.com/WebKit/WebKit/commit/c408a82764d20985bb78dbc1b4847bfa9eb5dad9
  Author: Simon Fraser <[email protected]>
  Date:   2023-05-10 (Wed, 10 May 2023)

  Changed paths:
    M Source/WTF/wtf/cf/RunLoopCF.cpp
    M Source/WebCore/PAL/pal/HysteresisActivity.h

  Log Message:
  -----------
  HysteresisActivity::impulse() thrashes a timer
https://bugs.webkit.org/show_bug.cgi?id=256572
rdar://109134335

Reviewed by Chris Dumez.

`HysteresisActivity::impulse()` stops and re-starts a timer simply to 
reschedule it into the future;
this destroys and recreates the timer every time, which is expensive. The 
implementation of
`HysteresisActivity::impulse()` can simply restart the timer.

We can make this cheaper by rescheduling the CFTimerRef if it hasn't fired yet, 
so add support for
this in `RunLoop::TimerBase::start()`; we can only reschedule non-repeating 
timers which haven't
fired yet, but this is fairly common.

* Source/WTF/wtf/cf/RunLoopCF.cpp:
(WTF::RunLoop::TimerBase::start):
* Source/WebCore/PAL/pal/HysteresisActivity.h:
(PAL::HysteresisActivity::start):
(PAL::HysteresisActivity::stop):
(PAL::HysteresisActivity::impulse):

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to