RESOLVED FIXED223087
Introduce WorkQueue::main() to get the main thread's work queue
https://bugs.webkit.org/show_bug.cgi?id=223087
Summary Introduce WorkQueue::main() to get the main thread's work queue
Chris Dumez
Reported 2021-03-11 13:53:38 PST
Introduce WorkQueue::main() to get the main thread's work queue. This allows us to port some more code from dispatch_queue to WorkQueue. It also simplifies some code that has to deal that sometimes needs to run on the main thread and other times on a background queue. Having a single WorkQueue type to represent both the main thread and a background queue makes writing such code more convenient.
Attachments
Patch (55.66 KB, patch)
2021-03-11 13:59 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (55.70 KB, patch)
2021-03-11 14:09 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (55.97 KB, patch)
2021-03-11 14:18 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (56.23 KB, patch)
2021-03-11 14:27 PST, Chris Dumez
ews-feeder: commit-queue-
Chris Dumez
Comment 1 2021-03-11 13:59:27 PST
Chris Dumez
Comment 2 2021-03-11 14:09:33 PST
Chris Dumez
Comment 3 2021-03-11 14:18:44 PST
Chris Dumez
Comment 4 2021-03-11 14:27:14 PST
Geoffrey Garen
Comment 5 2021-03-11 15:41:32 PST
Comment on attachment 422972 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=422972&action=review r=me > Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm:214 > - dispatch_async(dispatch_get_main_queue(), makeBlockPtr([this, strongThis = makeRef(*this), callbackID] { > + WorkQueue::main().dispatch([this, strongThis = makeRef(*this), callbackID] { I wonder about cases like this. Do they use WorkQueue rather than RunLoop for any specific purpose? Perhaps we should just make RunLoop::main() safe to call before main thread initialization, just like WorkQueue::main.
Chris Dumez
Comment 6 2021-03-11 15:52:23 PST
(In reply to Geoffrey Garen from comment #5) > Comment on attachment 422972 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=422972&action=review > > r=me > > > Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm:214 > > - dispatch_async(dispatch_get_main_queue(), makeBlockPtr([this, strongThis = makeRef(*this), callbackID] { > > + WorkQueue::main().dispatch([this, strongThis = makeRef(*this), callbackID] { > > I wonder about cases like this. Do they use WorkQueue rather than RunLoop > for any specific purpose? Perhaps we should just make RunLoop::main() safe > to call before main thread initialization, just like WorkQueue::main. There is a CFRunLoopGetMain() so in theory, we should be able to get RunLoop::main() working before main thread initialization?
Geoffrey Garen
Comment 7 2021-03-11 16:00:01 PST
Right, I think so.
Chris Dumez
Comment 8 2021-03-11 16:01:29 PST
Comment on attachment 422972 [details] Patch Clearing flags on attachment: 422972 Committed r274307 (235201@main): <https://commits.webkit.org/235201@main>
Chris Dumez
Comment 9 2021-03-11 16:01:32 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 10 2021-03-11 16:02:17 PST
Note You need to log in before you can comment on or make changes to this bug.