Bug 213771 - [Cocoa] [GTK] RunLoop::Timer::isActive() is incorrect for timers while they are firing
Summary: [Cocoa] [GTK] RunLoop::Timer::isActive() is incorrect for timers while they a...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Geoffrey Garen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-06-29 20:32 PDT by Geoffrey Garen
Modified: 2020-06-30 22:21 PDT (History)
9 users (show)

See Also:


Attachments
Patch (2.96 KB, patch)
2020-06-29 20:44 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Patch (4.04 KB, patch)
2020-06-30 12:30 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff
Assertion fix (1.37 KB, patch)
2020-06-30 22:00 PDT, Geoffrey Garen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Garen 2020-06-29 20:32:20 PDT
RunLoop::Timer::isActive() is true for one-shot timers even when they're not active
Comment 1 Geoffrey Garen 2020-06-29 20:44:41 PDT
Created attachment 403168 [details]
Patch
Comment 2 Geoffrey Garen 2020-06-30 07:44:49 PDT
Looks like a variant of gtk had this bug too.
Comment 3 Geoffrey Garen 2020-06-30 12:30:24 PDT
Created attachment 403223 [details]
Patch
Comment 4 Darin Adler 2020-06-30 17:19:33 PDT
Comment on attachment 403223 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=403223&action=review

> Source/WTF/wtf/cf/RunLoopCF.cpp:95
> +    if (!CFRunLoopTimerDoesRepeat(cfTimer))
> +        timer->stop();
> +
>      timer->fired();

Could we have put this code inside TimerBase::fired instead? Or does it not have an efficient way to check if the timer is non-repeating?

If stop() would do the trick on GLib too that would be neat.
Comment 5 Geoffrey Garen 2020-06-30 17:50:17 PDT
Glib already had the implicit stop behavior. It needed the inverse fix: be sure to restart if you are a repeating timer. 

I do think we can/should do a shared implementation of isActive in TimerBase. Windows already has all the code we need; just need to migrate it. I hope to return and do that after I finish off callOnMainThread.
Comment 6 EWS 2020-06-30 19:17:30 PDT
Committed r263783: <https://trac.webkit.org/changeset/263783>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 403223 [details].
Comment 7 Radar WebKit Bug Importer 2020-06-30 19:18:14 PDT
<rdar://problem/64967584>
Comment 8 Geoffrey Garen 2020-06-30 22:00:02 PDT
Reopening to attach new patch.
Comment 9 Geoffrey Garen 2020-06-30 22:00:03 PDT
Created attachment 403265 [details]
Assertion fix
Comment 10 EWS 2020-06-30 22:21:13 PDT
Committed r263786: <https://trac.webkit.org/changeset/263786>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 403265 [details].