Regression(r240562) Audio sometimes keeps playing in previous process after a process...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 19:56:44 +0000 (19:56 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Apr 2019 19:56:44 +0000 (19:56 +0000)
commit1aaaa8039aaf6dbd8f7090aaa83908a7eba074eb
treef6c14656b0df249531a09440f4e88a6ee458d86f
parentf61c20bc989d23216f0128a3124b7c131e1af78f
Regression(r240562) Audio sometimes keeps playing in previous process after a process-swap
https://bugs.webkit.org/show_bug.cgi?id=196774
<rdar://problem/49460572>

Reviewed by Alex Christensen.

r240562 added logic to prevent flashing on navigation. When we receive the DidFailToSuspendAfterProcessSwap
IPC from the previous process, we would delay closing the WebPage in that process until EnterAcceleratedCompositingMode
IPC is received from the new process. The issue is that this was racy as we would receive the EnterAcceleratedCompositingMode
IPC from the new process *before* receiving the DidFailToSuspendAfterProcessSwap IPC from the previous process, which which
case we would fail to close the WebPage and audio could keep playing.

To address the issue, the WebPageProxy keeps track of its last suspended page and notifies it whenever it receives the
EnterAcceleratedCompositingMode IPC. If the suspended page already received the DidFailToSuspendAfterProcessSwap IPC, it
will close the page. Otherwise, it will set a boolean data member indicating that we should not delay page closing when
the DidFailToSuspendAfterProcessSwap is eventually received.

* UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::SuspendedPageProxy):
(WebKit::SuspendedPageProxy::pageEnteredAcceleratedCompositingMode):
(WebKit::SuspendedPageProxy::didProcessRequestToSuspend):
* UIProcess/SuspendedPageProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::suspendCurrentPageIfPossible):
(WebKit::WebPageProxy::enterAcceleratedCompositingMode):
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessPool.cpp:
* UIProcess/WebProcessPool.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244144 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/SuspendedPageProxy.cpp
Source/WebKit/UIProcess/SuspendedPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h