| Summary: | Introduce a MainThreadBridge class inside WebLockManager | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Chris Dumez <cdumez> | ||||
| Component: | WebCore Misc. | Assignee: | Chris Dumez <cdumez> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | achristensen, darin, ggaren, sam, webkit-bug-importer, youennf | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Nightly Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 232436 | ||||||
| Attachments: |
|
||||||
|
Description
Chris Dumez
2021-12-02 16:23:20 PST
Created attachment 445786 [details]
Patch
Comment on attachment 445786 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=445786&action=review > Source/WebCore/Modules/web-locks/WebLockManager.cpp:68 > +class WebLockManager::MainThreadBridge : public ThreadSafeRefCounted<MainThreadBridge, WTF::DestructionThread::Main> { Are we reference counting this just for the "destroy on main thread" bit? Because if so, I suggest we instead use unique_ptr and null it out on the main thread in ~WebLockManager. I don’t see any ref/deref of this going on. Comment on attachment 445786 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=445786&action=review We need ref-counting to keep ourselves alive while dispatching to the main thread as well. > Source/WebCore/Modules/web-locks/WebLockManager.cpp:161 > + Ref protectedThis { *this }; We Ref here. > Source/WebCore/Modules/web-locks/WebLockManager.cpp:165 > + downcast<WorkerGlobalScope>(*m_context).thread().workerLoaderProxy().postTaskToLoader([task = WTFMove(task), protectedThis = Ref { *this }](auto& context) { and here. Committed r286474 (244813@main): <https://commits.webkit.org/244813@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 445786 [details]. |