RESOLVED FIXED 223094
Drop some unnecessary RunLoop::isMain() / IsMainRunLoop() checks
https://bugs.webkit.org/show_bug.cgi?id=223094
Summary Drop some unnecessary RunLoop::isMain() / IsMainRunLoop() checks
Chris Dumez
Reported 2021-03-11 14:55:17 PST
Drop some unnecessary RunLoop::isMain() / IsMainRunLoop() checks. callOnMainThread() / ensureOnMainRunLoop() take care of calling their lambda synchronously when already on the main runloop.
Attachments
Patch (5.89 KB, patch)
2021-03-11 14:56 PST, Chris Dumez
no flags
Patch (11.87 KB, patch)
2021-03-11 15:12 PST, Chris Dumez
no flags
Patch (11.87 KB, patch)
2021-03-11 15:57 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2021-03-11 14:56:59 PST
Chris Dumez
Comment 2 2021-03-11 15:00:24 PST
Found some more. Will update the patch.
Chris Dumez
Comment 3 2021-03-11 15:12:01 PST
Darin Adler
Comment 4 2021-03-11 15:36:11 PST
Comment on attachment 422978 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=422978&action=review > Source/WebKit/Platform/IPC/Connection.cpp:933 > + ensureOnMainRunLoop([this, protectedThis = makeRef(*this), messageName]() mutable { I slightly prefer the "only capture protectedThis" style, but I guess you like the "capture both" style? > Source/WebKit/Shared/Plugins/NPObjectProxy.cpp:307 > + NPObjectProxy* npObjectProxy = toNPObjectProxy(npObject); > + delete npObjectProxy; Better as a one-liner: delete toNPObjectProxy(npObject); > Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:225 > + ensureOnMainRunLoop([this, protectedThis = makeRef(*this)] { Maybe we should just capture the three identifiers and not capture the object at all? Would be nice to not have to worry about reference counting at all. > Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:226 > + if (auto* serviceWorkerThreadProxy = SWContextManager::singleton().serviceWorkerThreadProxy(m_serviceWorkerIdentifier)) Just call the local variable "proxy"?
Chris Dumez
Comment 5 2021-03-11 15:37:54 PST
Comment on attachment 422978 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=422978&action=review >> Source/WebKit/Platform/IPC/Connection.cpp:933 >> + ensureOnMainRunLoop([this, protectedThis = makeRef(*this), messageName]() mutable { > > I slightly prefer the "only capture protectedThis" style, but I guess you like the "capture both" style? Yes, I like capturing this because it makes the code more concise in the lambda. >> Source/WebKit/Shared/Plugins/NPObjectProxy.cpp:307 >> + delete npObjectProxy; > > Better as a one-liner: > > delete toNPObjectProxy(npObject); OK >> Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:225 >> + ensureOnMainRunLoop([this, protectedThis = makeRef(*this)] { > > Maybe we should just capture the three identifiers and not capture the object at all? Would be nice to not have to worry about reference counting at all. Good idea, will do. >> Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:226 >> + if (auto* serviceWorkerThreadProxy = SWContextManager::singleton().serviceWorkerThreadProxy(m_serviceWorkerIdentifier)) > > Just call the local variable "proxy"? Ok.
Chris Dumez
Comment 6 2021-03-11 15:57:34 PST
EWS
Comment 7 2021-03-11 19:51:33 PST
Committed r274322: <https://commits.webkit.org/r274322> All reviewed patches have been landed. Closing bug and clearing flags on attachment 422984 [details].
Radar WebKit Bug Importer
Comment 8 2021-03-11 19:52:16 PST
Note You need to log in before you can comment on or make changes to this bug.