Bug 260369

Summary: Enable requestIdleCallback by default in Apple's ports
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: DOMAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, mcatanzaro, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=262551
Bug Depends on:    
Bug Blocks: 164193, 262358    

Description Ryosuke Niwa 2023-08-17 16:09:22 PDT
Enable this feature by default on Apple ports.
Comment 1 Ryosuke Niwa 2023-08-17 16:14:20 PDT
Pull request: https://github.com/WebKit/WebKit/pull/16813
Comment 2 EWS 2023-08-17 18:01:28 PDT
Committed 267023@main (e225f383b875): <https://commits.webkit.org/267023@main>

Reviewed commits have been landed. Closing PR #16813 and removing active labels.
Comment 3 Radar WebKit Bug Importer 2023-08-17 18:02:16 PDT
<rdar://problem/114057284>
Comment 4 Michael Catanzaro 2023-08-18 06:07:22 PDT
Isn't this needed everywhere? Is there something wrong with the implementation on other ports?
Comment 5 Brent Fulgham 2023-08-18 09:47:48 PDT
(In reply to Michael Catanzaro from comment #4)
> Isn't this needed everywhere? Is there something wrong with the
> implementation on other ports?

The current code is specific to the CoreFoundation runloop implementation. Similar changes for GTK's run loop API would be needed on that platform (and likewise for Windows).
Comment 6 Michael Catanzaro 2023-08-19 08:09:33 PDT
Can you give me some pointers to what needs implemented, please? I skimmed through all recent commits looking for platform-specific code and didn't find anything. And since the implementation is built unconditionally, we already know it doesn't use any platform-specific methods of RunLoop.

GTK/WPE will have an issue where idle callbacks will be scheduled at too-high priority, which will need to be fixed, but that shouldn't stop the feature from working.
Comment 7 Ryosuke Niwa 2023-08-19 12:57:55 PDT
(In reply to Michael Catanzaro from comment #6)
> Can you give me some pointers to what needs implemented, please? I skimmed
> through all recent commits looking for platform-specific code and didn't
> find anything. And since the implementation is built unconditionally, we
> already know it doesn't use any platform-specific methods of RunLoop.
> 
> GTK/WPE will have an issue where idle callbacks will be scheduled at
> too-high priority, which will need to be fixed, but that shouldn't stop the
> feature from working.

You need to implement these functions: RunLoopObserver::schedule, RunLoopObserver::invalidate, and RunLoopObserver::isScheduled():

https://github.com/WebKit/WebKit/blob/main/Source/WebCore/platform/RunLoopObserver.cpp
Comment 8 Michael Catanzaro 2023-08-21 12:27:11 PDT
Thanks!

Unfortunately this looks hard, so I've created bug #260478 to track it.