RESOLVED FIXED 223073
Replace some usage of dispatch_queue with WorkQueue now that it supports sync dispatching
https://bugs.webkit.org/show_bug.cgi?id=223073
Summary Replace some usage of dispatch_queue with WorkQueue now that it supports sync...
Chris Dumez
Reported 2021-03-11 09:48:01 PST
Replace some usage of dispatch_queue with WorkQueue now that it supports sync dispatching.
Attachments
Patch (27.00 KB, patch)
2021-03-11 10:02 PST, Chris Dumez
no flags
Patch (27.09 KB, patch)
2021-03-11 11:10 PST, Chris Dumez
ews-feeder: commit-queue-
Patch (27.09 KB, patch)
2021-03-11 11:34 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2021-03-11 10:02:37 PST
Darin Adler
Comment 2 2021-03-11 10:16:07 PST
Comment on attachment 422941 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=422941&action=review > Source/WebCore/platform/audio/ios/AudioSessionIOS.mm:107 > - OSObjectPtr<dispatch_queue_t> m_dispatchQueue; > + RefPtr<WorkQueue> m_workQueue; > RetainPtr<WebInterruptionObserverHelper> m_interruptionObserverHelper; This now adds a non-thread-safe reference count to this object. I’m assuming that didn’t matter. Also, given that everything here is public, this seems more like a struct than a class. > Source/WebCore/platform/audio/ios/AudioSessionIOS.mm:271 > + NSError* error = nil; We normally format this as "NSError *". The old code above didn’t do that, but the code below did. > Source/WebCore/platform/audio/ios/AudioSessionIOS.mm:272 > + m_private->m_workQueue->dispatchSync([&error] { Can we make a bool come out of this thing instead of a possibly-already-deallocated NSError that we check against nil?
Chris Dumez
Comment 3 2021-03-11 11:05:07 PST
(In reply to Darin Adler from comment #2) > Comment on attachment 422941 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=422941&action=review > > > Source/WebCore/platform/audio/ios/AudioSessionIOS.mm:107 > > - OSObjectPtr<dispatch_queue_t> m_dispatchQueue; > > + RefPtr<WorkQueue> m_workQueue; > > RetainPtr<WebInterruptionObserverHelper> m_interruptionObserverHelper; > > This now adds a non-thread-safe reference count to this object. I’m assuming > that didn’t matter. What non-thread-safe reference count? WorkQueue definitely subclasses ThreadSafeRefCounted. > > Also, given that everything here is public, this seems more like a struct > than a class. > > > Source/WebCore/platform/audio/ios/AudioSessionIOS.mm:271 > > + NSError* error = nil; > > We normally format this as "NSError *". The old code above didn’t do that, > but the code below did. OK. > > > Source/WebCore/platform/audio/ios/AudioSessionIOS.mm:272 > > + m_private->m_workQueue->dispatchSync([&error] { > > Can we make a bool come out of this thing instead of a > possibly-already-deallocated NSError that we check against nil? OK.
Chris Dumez
Comment 4 2021-03-11 11:10:36 PST
Darin Adler
Comment 5 2021-03-11 11:23:54 PST
(In reply to Chris Dumez from comment #3) > What non-thread-safe reference count? WorkQueue definitely subclasses > ThreadSafeRefCounted. My mistake.
Darin Adler
Comment 6 2021-03-11 11:30:13 PST
Comment on attachment 422947 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=422947&action=review > Source/WebCore/platform/audio/ios/AudioSessionIOS.mm:272 > + m_private->m_workQueue->dispatchSync([&error] { Should be &success, not &error
Chris Dumez
Comment 7 2021-03-11 11:34:59 PST
EWS
Comment 8 2021-03-11 12:47:37 PST
Committed r274296: <https://commits.webkit.org/r274296> All reviewed patches have been landed. Closing bug and clearing flags on attachment 422951 [details].
Radar WebKit Bug Importer
Comment 9 2021-03-11 12:48:16 PST
Note You need to log in before you can comment on or make changes to this bug.