Skip to content

Commit

Permalink
REGRESSION(269895@main):[WPE] 52 new API tests failures
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=263974

Reviewed by Michael Catanzaro.

Revert part of 269895@main which would cause the WebProcessProxy to outlive
its WebProcessPool in some cases, unnecessarily.

Also add a null check for the process pool is the WebProcessProxy destructor
before using it, for extra safety.

* Source/WebKit/UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::~WebProcessProxy):
(WebKit::WebProcessProxy::isResponsive):
(WebKit::WebProcessProxy::isResponsiveWithLazyStop):

Canonical link: https://commits.webkit.org/270070@main
  • Loading branch information
cdumez authored and mcatanzaro committed Nov 1, 2023
1 parent f1664d7 commit 42d0220
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Source/WebKit/UIProcess/WebProcessProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@ WebProcessProxy::~WebProcessProxy()
WebPasteboardProxy::singleton().removeWebProcessProxy(*this);

#if HAVE(DISPLAY_LINK)
processPool().displayLinks().stopDisplayLinks(m_displayLinkClient);
// Prewarmed / cached processes may not have a process pool on destruction.
if (RefPtr processPool = m_processPool.get())
processPool->displayLinks().stopDisplayLinks(m_displayLinkClient);
#endif

auto isResponsiveCallbacks = WTFMove(m_isResponsiveCallbacks);
Expand Down Expand Up @@ -1873,11 +1875,10 @@ void WebProcessProxy::isResponsive(CompletionHandler<void(bool isWebProcessRespo
m_isResponsiveCallbacks.append(WTFMove(callback));

checkForResponsiveness([weakThis = WeakPtr { *this }]() mutable {
RefPtr protectedThis = weakThis.get();
if (!protectedThis)
if (!weakThis)
return;

for (auto& isResponsive : std::exchange(protectedThis->m_isResponsiveCallbacks, { }))
for (auto& isResponsive : std::exchange(weakThis->m_isResponsiveCallbacks, { }))
isResponsive(true);
});
}
Expand All @@ -1891,11 +1892,10 @@ void WebProcessProxy::isResponsiveWithLazyStop()
// We do not send a ping if we are already waiting for the WebProcess.
// Spamming pings on a slow web process is not helpful.
checkForResponsiveness([weakThis = WeakPtr { *this }]() mutable {
RefPtr protectedThis = weakThis.get();
if (!protectedThis)
if (!weakThis)
return;

for (auto& isResponsive : std::exchange(protectedThis->m_isResponsiveCallbacks, { }))
for (auto& isResponsive : std::exchange(weakThis->m_isResponsiveCallbacks, { }))
isResponsive(true);
}, UseLazyStop::Yes);
}
Expand Down

0 comments on commit 42d0220

Please sign in to comment.